Boost logo

Boost Users :

Subject: [Boost-users] mpl::map ---> fusion::map conversion problems
From: Zachary Turner (divisortheory_at_[hidden])
Date: 2009-08-10 23:37:11


Hello, I'm trying to convert an MPL map to a fusion map using
boost::fusion::result_of::as_map. I have the following code, with
some of the leading-in code omitted for brevity although I don't think
it's relevant:

                        //listener_info_types := mpl::list< pair<handler<E>, token<H> > >
                        typedef typename boost::mpl::transform<
                                handler_types, token_types,
                                parameterize_pair<boost::mpl::_1, boost::mpl::_2>
>::type listener_info_types;

                        //listener_info_lookup = mpl::map<EventType, pair<handler<E>, token<H> >
                        typedef typename boost::mpl::transform<
                                SupportedEvents, listener_info_types,
                                boost::mpl::inserter<
                                        boost::mpl::map<>,
                                        boost::mpl::identity<boost::mpl::_1>
>
>::type listener_info_lookup;

                        typedef typename
                                boost::fusion::result_of::as_map<listener_info_lookup>::type fusion_listener_map;

Deleting the last line and everything works. I've successfully used a
similar technique to convert mpl vectors to fusion vectors in the
past, is it not possible for maps? Or more likely I'm just doing
something wrong? I can post more code if necessary including full
type definitions leading up to all these previous typedefs, but
basically I have a class parameterized initially with an mpl::list of
some number of types. I then do a sequence of mpl::transform calls,
none of which with use a custom inserter. The end result of all of
that is listener_info_types above. So listener_info_types should be
an mpl::list. The next call should then create an mpl::map,
(SupportedEvents is the initial type used to parameterize the class,
so an mpl::list as previously mentioned).

Any suggestions?

Thanks
Zach


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net