如何从mpl::vector生成fusion::vector?如何从fusion::vector生成mpl::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 >));我需要generate_fusion_vector和generate_mpl_vector元函数。我可以编写自己的元函数,但我怀疑它们已经存在。
我以前有过使用help result_of::as_map生成fusion::map的经验,但在当前的boost(主干,1.39 )中会出现这样的错误:
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我不明白这是怎么回事?
发布于 2009-06-24 09:09:58
当fusion接受mpl类型作为函数的参数时,您可以尝试这样做:
BOOST_MPL_ASSERT((is_same<
fusion::vector<int, char>,
fusion::result_of::as_vector<mpl::vector<int, char> >::type >));编辑:
我认为这对您不起作用的原因是您必须包含某些头文件以在fusion中启用mpl兼容性。
#include <boost/fusion/adapted/mpl.hpp>
#include <boost/fusion/include/mpl.hpp>发布于 2009-11-19 10:51:42
我不知道你们是否还在做char,int,但是我遇到了同样的错误,我的问题是,我试图做一个长度为11的向量,但是FUSION_MAX_VECTOR_SIZE是10。
https://stackoverflow.com/questions/1036924
复制相似问题