Hello.
I am trying to instantiate a template taking two parameters across a series
of types contained in mpl::vector's, and place the resulting types in an
mpl::vector.
template class T {};
typedef mpl::vector Atypes;
typedef mpl::vector Btypes;
template class TEMPLATE,
class ATYPE,
class BTYPES,
class CLASSES>
struct unary_fold_inner : mpl::fold<
BTYPES,
CLASSES,
mpl::push_back >
{};
template class TEMPLATE,
class ATYPES,
class BTYPES>
struct unary_fold : mpl::fold<
ATYPES,
mpl::vector<>,
typename detail::unary_fold_inner::type
{};
typedef unary_fold<
T,
Atypes,
Btypes
::type CLASSES;
I expect CLASSES will be an mpl::vector containing 2x3=6 types as follows:
T
T
T
T
T
T
in other words, instantiating template T across all permutations of Atypes
and Btypes.
What I see instead is puzzling. Classes is indeed an mpl::vector, and indeed
contains 6 types, but the types are simply:
T
T
T
T
T
T
The iteration I'm trying to accomplish is all wrong. I think it has to do
with how I'm creating my metafunctions. I'm still unclear about when the
::type suffix is needed (for the last parameter to mpl::fold<> for example)
and whether I need an "apply" template somewhere in my struct's.
Any help appreciated.
v