
Andrei Alexandrescu skrev:
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.
A "not" slipped here.
Yes, until is lazy. I think it couldn't be implemented any other way for input ranges.
Ok, but the problem with lazy ranges is that when you compose it with range adaptors, then it greatly limits the adaptors that you can subsequently apply. -Thorsten