|
Boost : |
From: Daniel James (daniel_at_[hidden])
Date: 2004-12-01 08:42:09
Ryan Saunders wrote:
> here's an example:
>
> typedef typename meta_func< typename T0::inner_type, typename
> T1::inner_type, typename T2::inner_type>::type;
>
> I don't see a way to do this with any of the ENUM_XXX macros.
You can do this:
#define INNER_TYPE(z, n, data) typename T##n::inner_type
typedef typename meta_func< BOOST_PP_ENUM(3, INNER_TYPE, _) >::type;
which is more general purpose than supplying a macro for every possibility.
> Maybe something
> like ENUM_SPLIT_PARAMS(COUNT, PREF, SUFF) that would generate
> PREF ## n ## SUFF?
That wouldn't actually work in this case, since you can't concatenate a
number onto a symbol - you probably mean PREF ## n SUFF. If you want
this, you can do it yourself:
#define ENUM_SPLIT_PARAMS(COUNT, PREF, SUFF) \
BOOST_PP_ENUM(COUNT, ENUM_SPLIT_PARAMS_OP, (PREF, SUFF))
#define ENUM_SPLIT_PARAMS_OP(z, n, data) \
BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2, 0, data), n) \
BOOST_PP_TUPLE_ELEM(2, 1, data)
Daniel
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk