
19 Mar
2013
19 Mar
'13
2:44 p.m.
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()); }