Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] transform and transform_view
From: Joel de Guzman (joel_at_[hidden])
Date: 2011-04-22 21:50:48


On 4/22/2011 9:06 PM, Karsten Ahnert wrote:
>> Try:
>>
>> fusion::result_of::transform< vector_type const, operation>::type tv2
>> = fusion::transform( v , operation() );
>>
>> Notice the const. As of now, Fusion many algos accept only const
>> sequences. There's a rationale why: Fusion algos are basically
>> non-mutating and returns views. Anyway, I intend to relax this
>> restriction and accept non-const sequences soon.
>>
>> Regards,
>
> Thank you, it works. Is there a simple way to do a non-lazy transform?

Just assign it back to the vector:

   typedef fusion::vector< int , float> vector_type;
   vector_type v( 1 , 3.4 );

   v = fusion::transform( v , operation() );

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://boost-spirit.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net