gpt4 book ai didi

c++ - 我如何将 boost::mpl::fold 与 boost::fusion::map 一起使用?

转载 作者:太空狗 更新时间:2023-10-29 23:10:12 25 4
gpt4 key购买 nike

当我尝试编译时:

#include <boost/fusion/container/map.hpp>
#include <boost/mpl/fold.hpp>

int main(int argc, char** argv)
{
typedef boost::fusion::map
<
boost::fusion::pair<int, const char*>,
boost::fusion::pair<long, char>
> FuMap;

FuMap fuMap("hello", 'w');

unsigned val = boost::mpl::fold
<
FuMap, boost::mpl::int_<0>, boost::mpl::next<boost::mpl::_1>
>::type::value;
}

我收到以下错误:

"...boost/mpl/begin_end.hpp", line 35: Error, nofieldfnd: 
apply is not a member of
boost::mpl::begin_impl<boost::fusion::fusion_sequence_tag>.

来自 fusion 文档:“fusion 提供了全面的兼容性与MPL。 fusion 序列完全符合MPL序列和MPL序列与 Fusion 完全兼容。您可以使用 Fusion如果您只想处理类型,请使用 MPL 上的序列。”

当我传递一个 boost::mpl::map 时,它起作用了。

有什么线索吗?

最佳答案

我在 http://news.gmane.org/gmane.comp.lib.boost.user 问了同样的问题Christopher Schmidt 的回答是正确的:

#include <boost/fusion/mpl.hpp>

应该可以解决你的问题"

关于c++ - 我如何将 boost::mpl::fold 与 boost::fusion::map 一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1980340/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com