|
Boost : |
Subject: Re: [boost] Is there any interest in Boost.Conversion?
From: Emil Dotchevski (emil_at_[hidden])
Date: 2010-05-29 00:16:20
On Fri, May 28, 2010 at 2:55 PM, vicente.botet <vicente.botet_at_[hidden]> wrote:
> ----- Original Message -----
> From: "Emil Dotchevski" <emil_at_[hidden]>
> What's wrong with
>
> std::vector<A1> va2;
> std::transform(vb2.begin(),vb2.end(),std::inserter(va2,va2.end()),bind(convert_to<A1>,_1));
>
> _______________________________________________
>
> Nothing. I find the expression longer, useing of iterators, inserters, binds, a place holder .... While the other uses just a function :)
The user can wrap the iterators and inserters in a function, and then
it'd be just a function too. That is, if they care; personally I
wouldn't bother.
> I think that conversions and assignation are a special case of transformations that merit special attention. Don't you?
> Or why we have conversion operators in C++? The question is why these operations need to be defined inside a class in a intrinsic way and not outside in a extrinsic way.
Implicit conversions are something else entirely. The reason why they
need to be members is not entirely clear to me, but I'd speculate that
it has to do with syntax, not semantics.
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