i have below simple function to convert a mpl::vector<...> to pack<...>
namespace mpl = boost::mpl;
template <typename... Ts>
struct pack{};
struct A{};
struct B{};
template <typename... P>
struct mp_append_impl;
template <template <typename...> typename P, typename... Ts, typename T>
struct mp_append_impl<P<Ts...>, T>
{
using type = P<Ts..., T>;
};
template <template <typename...> typename P, typename T>
struct mp_append_impl<P<void>, T>
{
using type = P<T>;
};
template <typename S>
struct mpl_to_pack
{
using SEQ = mpl::range_c<int, 0, mpl::size<S>::type::value>;
using type =
typename mpl::fold<SEQ, pack<void>, mp_append_impl<mpl::_1, typename mpl::at<S, mpl::_2>::type>>::type;
};
void main() {
std::cout << std::endl
<< boost::typeindex::type_id<mpl_to_pack<mpl::vector<A, B>>::type>().pretty_name() << std::endl;
}
}
why this function output pack<mpl_::void_, mpl_::void_> instead of pack<A, B>?