Boost logo

Boost Users :

Subject: Re: [Boost-users] [Fusion] fusion vector transformation into another fusion vector transformation.
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-10-05 19:44:40


On 10/6/10 6:10 AM, alfC wrote:
> I have class that is parameterized by several type (Boost::Unit units
> type).
>
> template<class U1, class U2, ...>
> class A{
> A(quantity<U1> q1, quantity<U2> q2, ... ){}
> };
>
> since the number of arguments is arbitrary I though it would be a good
> idea to use either MPL sequence and Tuples. Or better yet a
> fusion::vector.
>
> so the class will be parametrized by a fusion::vector or unit types.
>
> template<class FusionOfUnits> //or class MPLofUnits
> class A{
> A(FusionOfQuantities fq){} //or TupleOfUnits
> };
>
> The questions is: ¿what is the best way to transform a
> fusion::vector<unit1, unit2, unit3, ..., unitN>
> into a
> fusion::vector<quantity<unit1>, quantity<unit2>, quantity<unit3>, ...,
> quantity<unitN> >
>
> whete the N is (compile-time) arbitrary, i.e. the lenght of the fist
> fusion::vector is arbitrary
>
> (If you are not familiar with Boost.Units, unitN is just a type and
> quantity is a template type.)

Have you tried fusion::transform? Or fusion::transform_view?

Regards,

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

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