Generate fusion :: vector from mpl :: vector

How to generate fusion::vectorfrom mpl::vector? How to generate mpl::vectorfrom fusion::vector?

BOOST_MPL_ASSERT((is_same<
                  fusion::vector<int, char>,
                  generate_fusion_vector<mpl::vector<int, char> >::type >));

BOOST_MPL_ASSERT((is_same<
                  mpl::vector<int, char>,
                  generate_mpl_vector<fusion::vector<int, char> >::type >));

I need metafiles generate_fusion_vectorand generate_mpl_vector. I can write my own metafiles, but I suspect that they already exist.

I had experience generating fusion::mapwith help result_of::as_mapbefore, but in the current effort (trunk, 1.39), this error also occurs:

D:\Libraries\boost_trunk\boost/fusion/sequence/intrinsic/size.hpp(56) : error C2903: 'apply' : symbol is neither a class template nor a function template
        D:\Libraries\boost_trunk\boost/fusion/container/vector/convert.hpp(23) : see reference to class template instantiation 'boost::fusion::result_of::size' being compiled
        with
        [
            Sequence=boost::mpl::vector
        ]
        temp.cpp(71) : see reference to class template instantiation 'boost::fusion::result_of::as_vector' being compiled

I do not understand what's going on?

+3
source share
2 answers

Since fusion accepts mpl types as arguments to functions, you can try the following:

BOOST_MPL_ASSERT((is_same<
fusion::vector<int, char>,
fusion::result_of::as_vector<mpl::vector<int, char> >::type >));

Edit:

, , , , , mpl fusion.

#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/include/mpl.hpp>
+7

, char, int, , , 11, FUSION_MAX_VECTOR_SIZE 10.

0

Source: https://habr.com/ru/post/1711151/