1

Why type is not same as expected in the example below?

using origin = boost::fusion::map<
    boost::fusion::pair<int, int>
>;
using expected = boost::fusion::map<
     boost::fusion::pair<int, int>
    ,boost::fusion::pair<char, char>
>;

using type = boost::fusion::result_of::push_back<
     origin
    ,boost::fusion::pair<char, char>
>::type;

static_assert(std::is_same<expected, type>::value, "error!");

The second question is, how can I get the same type as expected when using result_of::push_back<>::type ?

niXman
  • 1,698
  • 3
  • 16
  • 40

1 Answers1

1

You need to use fusion::result_of::as_map.

using origin = boost::fusion::map<
    boost::fusion::pair<int, int>
>;
using expected = boost::fusion::map<
     boost::fusion::pair<int, int>
    ,boost::fusion::pair<char, char>
>;

using type = typename boost::fusion::result_of::as_map<
    typename boost::fusion::result_of::push_back<
         origin
        ,boost::fusion::pair<char, char>
    >::type
>::type;
niXman
  • 1,698
  • 3
  • 16
  • 40
  • I think you can also use [`static_assert(boost::mpl::equal::value, "error!");`](http://www.boost.org/libs/mpl/doc/refmanual/equal.html) (including "boost/mpl/equal.hpp"). – llonesmiz Sep 03 '13 at 13:27