2009-12-30 26 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