
Hi, I am trying to generate a list of instances of the same template with different pairs of args, to populate a mpl container, with PP so, mpl::vector< tmpl<A::x,A::y>, tmpl<B::x,B::y>, tmpl<C::x, C::y> > i'm having trouble with the commas. I successfully generate the pp sequence (tmpl<A::x,A::y>)(tmpl<B::x,B::y>) (tmpl<C::x, C::y>) but from this to get the enumeration, it's impossible using SEQ_ENUM, because the sequence contains commas MM

"MM" <finjulhich@gmail.com> writes:
Hi,
I am trying to generate a list of instances of the same template with different pairs of args, to populate a mpl container, with PP
so, mpl::vector< tmpl<A::x,A::y>, tmpl<B::x,B::y>, tmpl<C::x, C::y> >
i'm having trouble with the commas.
I successfully generate the pp sequence (tmpl<A::x,A::y>)(tmpl<B::x,B::y>) (tmpl<C::x, C::y>)
but from this to get the enumeration, it's impossible using SEQ_ENUM, because the sequence contains commas
MM You could use something like:
#include <boost/preprocessor/seq.hpp> #include <boost/preprocessor/repetition/enum.hpp> #define SEQ (A)(B)(C) BOOST_PP_SEQ_ENUM(SEQ) #define TMPL(elem) (tmpl<elem::x, elem::y>) #define MACRO(z,n,data) TMPL(BOOST_PP_SEQ_ELEM(n, SEQ)) BOOST_PP_ENUM(3, MACRO, ) This also has the benefit of separating the class names from what you want to do with them. HTH, Philipp Moeller
participants (2)
-
MM
-
Philipp Moeller