|
Boost : |
Subject: Re: [boost] [range][iterator] contiguous iterators
From: Stefan Strasser (strasser_at_[hidden])
Date: 2013-03-19 10:44:37
Am 19.03.2013 15:23, schrieb Stefan Strasser:
> even copy() could benefit from this, e.g.:
>
> copy(Range const &r,OutputIterator out){
> copy(r,out,category of out);
> }
>
> copy(Range const &r,OutputIterator out,range_output_iterator_tag){
> *out=r;
> }
>
> "out" can now copy the whole range at once, using vector.reserve(). or
> sputn() it into a file without buffering. or whetever else.
> (for that, it needs is_contiguous<>)
note that, although copy() doesnt, the algorithm might output multiple
ranges, or a mix between ranges and values. so you can't just pass the
input range to whatever you want to do.
simple example:
load(OutputIterator out){
char buffer[N];
do{
file.load(buffer,N);
*out=buffer;
}while(!file.eof());
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk