Subject: Re: [boost] Formal Review: Boost.RangeEx
From: Rogier van Dalen (rogiervd_at_[hidden])
Date: 2009-02-26 09:25:34
On Thu, 2009-02-26 at 14:38 +0100, Thorsten Ottosen wrote:
> Rogier van Dalen skrev:
> > I still suggest removing any operation that uses output iterators
> > (except "copy"), and just use lazy versions.
> This you want to keep because of std::ostream_iterator?
I think output iterators can be useful, for example, in writing to files
or forms of linear storage. If C++ had coroutines, output iterators
would have been more generally useful.
But algorithms that take output iterators often force the user to write
to a temporary. They combine (in my mind) two operations: (1) processing
or producing data, and (2) writing the output out to a sink. (1) can be
written with lazy ranges; (2) can be written using copy(). I think all
current STL algorithms that take output iterators could be written as
copy()ing a lazy range to the output iterator. Looking at the "Mutating
algorithms" section of the RangeEx docs, I believe that goes for
copy_backward(), fill(), generate(), merge(), transform(), and the set
For efficiency, some combinations of copy() with lazy ranges could
forward to STL implementations.
I'd be happy to help out with lazy set algorithms since I've got
implementations lying around.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk