从 mpl::vector 生成 fusion::vector
如何从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
我不明白发生了什么事吗?
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 had an experience of generating fusion::map
with help result_of::as_map
before, 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于 fusion 接受 mpl 类型作为函数的参数,您可以尝试以下操作:
编辑:
我认为这对您不起作用的原因是您必须包含某些头文件才能在 fusion 中启用 mpl 兼容性。
As fusion accepts mpl types as arguments to functions you could try this:
Edit:
I think the reason this isn't working for you is that you have to include certain header files to enable mpl compatibility in fusion.
我不知道你是否还在做 char,int 但我遇到了同样的错误,我的问题是我尝试制作长度为 11 的向量,但 FUSION_MAX_VECTOR_SIZE 为 10。
I don't know if you're still doing char,int but I ran into the same error and my problem was that I tried to make a length 11 vector, but FUSION_MAX_VECTOR_SIZE was 10.