3

当我尝试编译这个时:

#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 完全兼容。如果您希望仅处理类型,则可以在 MPL 上使用 Fusion 序列。”

当我通过 boost::mpl::map 时,它可以工作。

有什么线索吗?

4

1 回答 1

1

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

#include <boost/fusion/mpl.hpp>

应该解决你的问题”

于 2009-12-30T17:05:37.270 回答