Hi Thorsten, Am 19.03.2013 16:18, schrieb Thorsten Ottosen:
It appears to me that you can just do that by implementing a wrapper class that enables you to call boost::push_back. If its too contrieved to use push_back, we may add a function called write:
I fail to see the difference between a "wrapper class that enables you to [output data]" and an output iterator.
template< class OutPutRange, class Rng > OutPutRange& write( OutPutRange& to, const Rng& from ) { to.write( from ); return to; }
Anyway, I guess its possible to define an "output range", but it does not seem desirable stick it into the existing interface for output iterators, does it?
it's desirable because a "range output iterator" as I call it for now is a regular output iterator. it has the same semantics as an output iterator, with the addition that it can accept ranges. this means that it can be passed to any algorithm accepting an OutputIterator. only if you choose to optimize an algorithm for ranges you have to write any additional code, e.g. by tag dispatching (see previous email). if you don't like the interface for inserting ranges I use, '*out=range', maybe 'out << range' or even 'out.insert(range)' suits it more, but 'out' has to be a regular output iterator for the whole thing to make sense. if you have to write 2 algorithms again, one accepting an output iterator, and the other one accepting this "wrapper class that can write ranges", it misses the point. Stefan