2009-06-24 50 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

相關問題