Boost logo

Boost :

From: Scott McMurray ([hidden])
Date: 2007-07-11 09:48:25

On 10/07/07, Marat Khalili <0x8.0p15_at_[hidden]> wrote:
> Are there any standard means to clone collection class while changing
> only element type? Like receiving some_collection<int> as a template
> parameter and creating some_collection<string> without knowing what
> exactly some_collection is.
It seems like a std::transform with a type conversion func and into an
insert iterator would do the job, or an iterator range constructor
from some kind of transform_iterator that I'm sure is in boost

std::vector<int> vi;
v += 1,2,3,4,5;
std::vector<std::string> vs;
std::transform( vi.begin(), i.end(),
   &boost::lexical_cast<std::string,int> );

~ Scott McMurray

P.S. We have containers in C++, not collections.

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