Boost logo

Boost Users :

Subject: [Boost-users] [Boost.MPL]is it possible to generate types with all combinations of template arguments?
From: Tan, Tom (Shanghai) (TTan_at_[hidden])
Date: 2009-09-29 07:49:36


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?

 

thanks.

 



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