Boost logo

Boost :

Subject: Re: [boost] Is there any interest in Boost.Conversion?
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-05-28 14:36:33


On Fri, May 28, 2010 at 5:23 AM, vicente.botet <vicente.botet_at_[hidden]> wrote:
> Hi,
>
> The Boost.Conversion library (Generic explicit conversion between unrelated types) has not revealed too much interest for the Boost community since v0.4 was released on 10/09.
>
> For those that don't know it yet you can get the documentation and download links from
> https://svn.boost.org/trac/boost/wiki/LibrariesUnderConstruction#Boost.Conversion
>
> I have added on the sandbox some pending issues that Jeffrey Hellrung  related to conversions that need extra information.
>
> If  B1 is covertible to A1 using convert_to, now we can conver vectors of conversible types.
>
>    B1 b10, b11, b12, b13;
>    std::vector<B1> vb2;
>    vb2[0]=b10;
>    vb2[1]=b11;
>    vb2[2]=b12;
>    vb2[3]=b13;
>    std::vector<A1> va2(boost::convert_to<std::vector<A1> >(vb2))

What's wrong with

std::vector<A1> va2;
std::transform(vb2.begin(),vb2.end(),std::inserter(va2,va2.end()),bind(convert_to<A1>,_1));

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk