Boost logo

Boost Users :

From: Ares Lagae (ares.lagae_at_[hidden])
Date: 2007-05-10 06:06:21


Joaquín, Mª López Muñoz wrote:

> I guess fusion can be used to implement what you want, but MPL probably
> also suffices. Please see the attached file, is this kind of what you're
> after?

Joaquín,

Thank you very much! This is (almost) exactly what I want. I have a couple
of questions though.

1/

Consider

typedef variable_list_seq<boost::mpl::vector<int, char, double> > vl_type;

Instead of having, for each type in the typelist, a variable of that type, I
need a variable depending on that type. This can easily be accomplished by
changing variable_list_member to hold my_type<T> rather than T.

I was wondering, however, if variable_list_member can be eliminated, and
my_type passed as a template argument. E.g. suppose I write a metafunction

template <typename T> struct my_type { typedef /* some type */ type; }

to somehow declare

typedef variable_list_seq<boost::mpl::vector<int, char, double>, my_type>
vl_type;

to obtain a variable list with "keys" int, char, double and variables of
type my_type<int>::type, ....

2/ would it be possible to generated variables my_type<T1, T2> for all
possible combinations of T1 and T2, where T1 and T2 are types in two
typelists?

Something like

typedef product_variable_list_seq<boost::mpl::vector<...>,
boost::mpl::vector<...>, my_type> vl_type;

where my_type is a

template <typename T1, typename T2> struct my_type { typedef /* some type */
type; }

Best regards,

--
Ares Lagae
Computer Graphics Research Group, Katholieke Universiteit Leuven
http://www.cs.kuleuven.be/~ares/

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