How can I use boost :: mpl :: fold with boost :: fusion :: map?

When I try to compile this:

#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;
}

I get the following error:

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

From the merge documentation: "Fusion provides full round-robin MPL compatibility. Merge sequences are fully consistent MPL sequences and MPL sequences are fully Fusion compatible. You can work with Fusion sequences on MPL if you want to work only on types."

When I pass boost :: mpl :: map, it works.

Any clues?

+3
source share
1 answer

http://news.gmane.org/gmane.comp.lib.boost.user, :

#include <boost/fusion/mpl.hpp>

"

+1

Source: https://habr.com/ru/post/1726892/


All Articles