|
Boost Users : |
Subject: Re: [Boost-users] [Boost.MPL]is it possible to generate types
From: Tan, Tom (Shanghai) (TTan_at_[hidden])
Date: 2009-10-13 09:06:27
Thanks, it works like a charm.
Tan, Tom (Shanghai) wrote:
> I have a templated class
>
> template<class U, class V, class W>
> class S
> {
> //... implementations
> };
>
> and some stock type implementations for type U, V and W:
>
> typedef boost::mpl::vector<U0, U1> u_types;
> typedef boost::mpl::vector<V0, V1, V2, V3, V4> u_types;
> typedef boost::mpl::vector<W0, W1, W2, W3, W4> w_types;
>
> I want to test class S with all possible combinations of the template
> arguments,
>
> typedef boost::mpl::vector<
> S<U0,V0,W0>,
> S<U0,V0,W1>,
> // ...
> S<U1,V4,W4>,
> > s_types;
>
> like this:
> boost::mpl::for_each<s_types>(test_func).
>
> The only problem is there are 2*5*5 = 50 combinations that I do not
> wish to type in one by one.
>
> Is there a way to generate all the combinations with boost::mpl or
> Boost.Preprocessor?
>>
Look at BOOST_PP_SEQ_FOR_EACH_PRODUCT
In Christ,
Steven Watanabe
***************************************
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