Boost logo

Boost Users :

Subject: Re: [Boost-users] Boost::mpl vector product
From: Larry Evans (cppljevans_at_[hidden])
Date: 2012-01-22 12:27:18


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

One name for this is operation is 'cross product'.
Another is 'outer product':

http://aplwiki.com/LearnApl/AplOperators#Outer_and_inner_products

That problem was discussed in this thread:

  http://thread.gmane.org/gmane.comp.lib.boost.devel/171761

It was also posed as a problem 7-8 here:

http://www.boostpro.com/mplbook/

One answer was posted here:

http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?CPPTM_Answers_-_Exercise_7-8

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