【发布时间】:2009-06-24 07:40:48
【问题描述】:
如何从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 元函数。
我可以编写自己的元函数,但我怀疑它们已经存在。
我之前有过在result_of::as_map 的帮助下生成fusion::map 的经验,但是在当前的 boost(trunk, 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
我不明白发生了什么?
【问题讨论】:
-
是否需要计算与mpl::vector相同类型的fusion::vector的类型(mpl::vectors只有类型,没有值),还是你的意思是mpl: :vector_c?
标签: c++ templates metaprogramming boost-fusion