Boost logo

Boost :

Subject: Re: [boost] [boost-lists][string algo] C++0x string algo.
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2010-01-17 17:55:55

Germán Diago skrev:
>> 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
>> mentioned.
> 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());

Right. And we also want to be able to say

for( const auto& r : split(str,...) )

so you are right that ranges are the way to go.


Boost list run by bdawes at, gregod at, cpdaniel at, john at