2009-12-30 67 views
3

当我尝试编译此:如何使用boost :: mpl :: fold和boost :: fusion :: map?

#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>. 

从融合文档:“融合提供了完整的圆兼容性 与MPL融合序列完全符合MPL。序列和MPL 序列与Fusion完全兼容。如果您希望仅使用类型,则可以在MPL上使用Fusion 序列。“

当我通过一个boost :: mpl :: map它的作品。

任何线索?

回答

1

我问同样的问题在http://news.gmane.org/gmane.comp.lib.boost.user和克里斯托弗·施密特的回答是正确的:

#include <boost/fusion/mpl.hpp> 

应该解决您的问题”

+0

包括抱歉,小于和大于抹去什么 – wallyk 2009-12-30 17:10:44

+0

?包括。现在它是固定的 – chila 2009-12-30 17:12:42

+0

谢谢,我编辑它为清晰 – wallyk 2009-12-30 17:14:31