Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost::mpl vector product
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-01-22 13:03:23


On 01/22/12 08:38, Allan Nielsen wrote:
> Hi
>
> If I have two mpl vectors: v1 and v2
>
> typedef boost::mpl::vector<char, short, int> v1;
> typedef boost::mpl::range_c<int,0,4> v2;
>
> Does boost then provide any tools for constructing the type:
>
> boost::mpl::vector<
> boost::mpl::pair< int_<0>, char >,
> boost::mpl::pair< int_<1>, char >,
> boost::mpl::pair< int_<2>, char >,
> boost::mpl::pair< int_<3>, char >,
>
> boost::mpl::pair< int_<0>, short >,
> boost::mpl::pair< int_<1>, short >,
> boost::mpl::pair< int_<2>, short >,
> boost::mpl::pair< int_<3>, short >,
>
> boost::mpl::pair< int_<0>, int >,
> boost::mpl::pair< int_<1>, int >,
> boost::mpl::pair< int_<2>, int >,
> boost::mpl::pair< int_<3>, int >
>>
>
> Best regards
> Allan W. Nielsen
The attached code uses variadic templates and code from:

http://svn.boost.org/svn/boost/sandbox/variadic_templates/boost/mpl/

and does what you want except, instead of mpl::pair, it produces
an mpl::vector whose size is the number of mpl sequences
on input.

HTH.

-Larry





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