
At Thu, 6 Jan 2011 13:23:11 +0000, Robert Jones wrote:
Yes.... I take your point about eager vs lazy, but on reflection is it not the case that almost any 'pipeline' of transformations has to end with 'eager' consumption?
No, it is not. In some languages, everything is lazy, and the only thing that eventually forces evaluation is I/O. You can easily pass around, store, and compose lazy ranges to your heart's content.
If I had
int f( int );
boost::for_each( vec | boost::adaptors::reversed | boost::adaptors::uniqued, f );
and instead were able to write it as
vec | boost::adaptors::reversed | boost::adaptors::uniqued | f;
the final use of operator|() seems to pretty much imply eagerness in the same way that the for_each() does.
Only if you happen to know that f is a function and will be treated completely differently from the range adaptors. -- Dave Abrahams BoostPro Computing http://www.boostpro.com