2009-06-24 62 views
3

如何从mpl::vector生成fusion::vector? 如何从fusion::vector生成mpl::vector从mpl :: vector生成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 >)); 

我需要generate_fusion_vectorgenerate_mpl_vector元函数。 我可以编写自己的元函数,但我怀疑它们已经存在。

我曾与前帮助result_of::as_map产生fusion::map的经验,但在当前增压(躯干,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 

我不明白这是怎么回事?

+0

你需要计算与mpl :: vector类型相同的fusion :: vector类型(mpl :: vectors只有类型,而不是值),还是你的意思是mpl :: vector_c? – 2009-06-24 08:44:13

+0

我想计算一个类型。 – Andreo 2009-06-24 08:57:10

回答

7

由于融合接受MPL类型作为函数的参数,你可以试试这个:

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

编辑:

我想,这是不是为你工作的原因是,你必须包括一定的头文件以在融合中启用mpl兼容性。

#include <boost/fusion/adapted/mpl.hpp> 
#include <boost/fusion/include/mpl.hpp> 
0

我不知道,如果你仍然在做焦炭,INT但我遇到了同样的错误,我的问题是,我试图让一个长11载体,但FUSION_MAX_VECTOR_SIZE是10