Boost logo

Boost Users :

Subject: [Boost-users] boost::mpl::map and inserting the same pair twice
From: peter_foelsche_at_[hidden]
Date: 2008-10-06 16:07:10


I'm inserting the same key-value pair twice.
And I'm getting a different type.
The following code does not compile due to the assertion firing:

#include <boost/mpl/map.hpp>
#include <boost/mpl/insert.hpp>
#include <boost/type_traits/is_same.hpp>

typedef boost::mpl::map<
        boost::mpl::pair<
                boost::mpl::int_<0>,
                boost::mpl::int_<1>
>,
        boost::mpl::pair<
                boost::mpl::int_<1>,
                boost::mpl::int_<0>
>
> CMyMap;

typedef boost::mpl::insert<
        CMyMap,
        boost::mpl::pair<
                boost::mpl::int_<2>,
                boost::mpl::int_<2>
>
> CNewMap;

int main(int, char**)
{ CMyMap s;
        CNewMap s1;
        BOOST_MPL_ASSERT((boost::is_same<
                boost::mpl::insert<
                        CNewMap,
                        boost::mpl::pair<
                                boost::mpl::int_<2>,
                                boost::mpl::int_<2>
>
>,
                CNewMap
> ));
        return 0;
}


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