Subject: Re: [boost] [boost-lists][string algo] C++0x string algo.
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2010-01-17 19:10:08
Germán Diago wrote:
>> I wouldn't find it ok for split to return a vector<string> since I like to
>> be kept in control of how I store my elements, and there is no control
>> without taking the container as an argument or using the method I just
> I would like to be able to use it like this:
> split(str, predseparators);
> Which returns a range. I think this is possible.
> You always return a range, and if you want to store it, you
> can copy the returned range to a vector<string>, for example.
> So it would be quite realistic (I think) to adapt split so that
> returns always ranges and
> if you want a copy, make a explicit copy in the code:
> auto r = split(str, predseparators);
> vector<string> vec(r.begin(), r.end());
Which is the mechanism I offered, i.e. lazy evaluation with range adapters.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk