我有两个不同的向量
mpl::vector<Type1, Type2...>
mpl::vector<Type3, Type4...>
我想要将它们“连接”起来形成:
mpl::vector<Type1, Type2, Type3, Type4...>
这将使我能够准备向量模板并之后重复使用它们。针对我的问题,有不同的解决方案,但这种方法似乎最为合适。
谢谢...
// include the appropriate headers
typedef mpl::vector<Type1, Type2> first_type;
typedef mpl::vector<Type3, Type4> second_type;
typedef mpl::copy<first_type::type, mpl::back_inserter<second_type> >::type concat_type;
vector<Type3,Type4,Type1,Type2>
。 - llonesmiztypedef mpl::vector<T0, T1> s0;
typedef mpl::vector<T2, T3> s1;
typedef mpl::copy<
s1,
mpl::back_inserter<s0>
>::type concatenated;
BOOST_MPL_ASSERT((
mpl::equal<
concatenated,
mpl::vector<T0, T1, T2, T3>
>
));