On 19-03-2013 11:03, Stefan Strasser wrote:
I'd also like to suggest another addition to Boost.Range: a RangeOutputIterator, i.e. an OutputIterator that doesn't only accept single values, but assignment of ranges:
template<class RangeOutputIterator> ... (...RangeOutputIterator out){ *out=range;
where range can be any Boost.Range. You can find an implementation of this concept here, in the form of an back insert iterator that can insert entire ranges into a vector: http://pastebin.com/9M5rPDh9
Using these two things together can make generic algorithms as efficient as is possible, e.g. if the container that is being written to is a vector and the value type is a POD, there's one call to std::memcpy. think e.g. about file or database operations like database.get(1024*1024,out);
This is in my "namespace detail" right now and I'd be willing to help make it public and document it.
Have you considered http://www.boost.org/doc/libs/1_53_0/libs/range/doc/html/range/reference/alg... ? E.g. using boost::push_back( my_container, my_range ) should be optimally efficient and more direct than using an output range. -Thorsten