[boost][fusion] generate mpl::vector from fusion::vector
How to generate fusion::vector from mpl::vector? How to generate mpl::vector from 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 generate_fusion_vector and generate_mpl_vector metafunctions. I can write my own metafunctions, but i suspect that they already exist. I generated fusion::map with help result_of::as_map before, so vector generation is the same, but in current boost(trunk, 1.39 also) such error occur: 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 don't understand what is going on? -- Regards, Andrey
2009/6/24 Andrey Torba <andreytorba@gmail.com>
BOOST_MPL_ASSERT((is_same< mpl::vector<int, char>, generate_mpl_vector<fusion::vector<int, char> >::type
));
generate_mpl_vector is boost::fusion::result_of::as_vector. I'm not sure if the result satisfies is_same<mpl::vector<...>, res>, but at least it's mpl::equal<mpl::vector<...>, res>. As to reverse conversion, I don't think there is a function for it, but usually one doesn't need it. Including boost/fusion/include/mpl.hpp makes all mpl sequences fusion sequences, so you can use mpl::vector<...> wherefusion::vector<...>is expected. Roman Perepelitsa.
AMDG Roman Perepelitsa wrote:
2009/6/24 Andrey Torba <andreytorba@gmail.com>
BOOST_MPL_ASSERT((is_same< mpl::vector<int, char>, generate_mpl_vector<fusion::vector<int, char> >::type
));
generate_mpl_vector is boost::fusion::result_of::as_vector. I'm not sure if the result satisfies is_same<mpl::vector<...>, res>, but at least it's mpl::equal<mpl::vector<...>, res>.
As to reverse conversion, I don't think there is a function for it, but usually one doesn't need it. Including boost/fusion/include/mpl.hpp makes all mpl sequences fusion sequences, so you can use mpl::vector<...> wherefusion::vector<...>is expected.
In particular, boost::mpl::copy<boost::fusion::vector<int, char>, boost::mpl::back_inserter<boost::mpl::vector0<> > >::type In Christ, Steven Watanabe
On Wed, Jun 24, 2009 at 5:41 PM, Steven Watanabe<watanabesj@gmail.com> wrote:
In particular, boost::mpl::copy<boost::fusion::vector<int, char>, boost::mpl::back_inserter<boost::mpl::vector0<> > >::type
Is it right way to use result_of::as_vector? I've used it before, but now it doesn't work. -- Regards, Andrey
participants (3)
-
Andrey Torba
-
Roman Perepelitsa
-
Steven Watanabe