
25 Jul
2009
25 Jul
'09
2:13 p.m.
Thorsten Ottosen wrote:
Andrei Alexandrescu skrev:
Surprisingly, until() also works on input ranges! It works because it finds the element lazily - it returns a range that tests for termination condition in its .empty() test. So until() returns a range that iterates the original passed-in range until the sought element is found, at which time until() reports termination.
Is until lazy for all types of ranges? Being lazy is often good, but it's so nice to compose a lazy range with other types of ranges.
Yes, until is lazy. I think it couldn't be implemented any other way for input ranges. Andrei