I added the ::type to every insert.

It still does not compile -- not using g++ nor using visual C++.

Error message is not helpful.

 

Also is there some operation to insert all elements of one map into another one?

This would be extremely helpful.

 

#include <boost/mpl/map.hpp>

#include <boost/mpl/insert.hpp>

#include <boost/mpl/size.hpp>

#include <boost/type_traits/is_same.hpp>

#include <boost/mpl/assert.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>

      >

> CMap2;

 

typedef boost::mpl::insert<

      CMap2,

      boost::mpl::pair<

            boost::mpl::int_<2>,

            boost::mpl::int_<3>

      >::type

> CMap3;

 

 

typedef boost::mpl::insert<

      CMap3,

      boost::mpl::pair<

            boost::mpl::int_<2>,

            boost::mpl::int_<3>

      >::type

> CMap31;

 

 

int main(int, char**)

{     CMap2 s;

      CMap3 s1;

      CMap31 s2;

      //BOOST_MPL_ASSERT((boost::is_same<CMap31, CMap3>));

      return 0;

}

 

 

"The first point (using an init() function in preference to a constructor) is bogus. Using constructors and exception handling is a more general and systematic way of dealing with resource acquisition and initialization errors. This style is a relic of pre-exception C++." -- Stroustrup