
Pavol Droba wrote:
Hi,
There are reasons for it.
One of them is the posibility to store result in reference-like container.
Example: vector<iterator_range<string::iterator> > tokens; split(tokens, input, token_comress_off);
This way you can have a split without copying overhead. I consider this functionality interesting enough to make the interface to be like it is now.
No overhead is good, but there might be a different way to achieve it: split( tokens, make_iterator_range(input), ... ); We could even get away with changing split(), but letting make_iterator_range() return a const iterator_range<T> (Erics suggestion). But OTOT, that would disallow a call to mutable functions afterwards. We could also add make_const_iterator_range(). Anyway, I do think the current behavior can be suprising at first and that those who want efficiency should do the extra work (at least in C++03). -Thorsten