[Boost-bugs] [Boost C++ Libraries] #8749: Accessing type of insert<map<>, pair<A, B> >::type discards inserted elements

Subject: [Boost-bugs] [Boost C++ Libraries] #8749: Accessing type of insert<map<>, pair<A, B> >::type discards inserted elements
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-06-30 22:04:35


#8749: Accessing type of insert<map<>, pair<A,B> >::type discards inserted
elements
------------------------------+-----------------------
 Reporter: guylaingreer@… | Owner: agurtovoy
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: mpl
  Version: Boost 1.52.0 | Severity: Problem
 Keywords: |
------------------------------+-----------------------
 The following code sample illustrates the problem

     typedef insert<map<>, pair<int, int> >::type little_map;

     BOOST_STATIC_ASSERT(size<little_map>::value == 1); /* Success */
     BOOST_STATIC_ASSERT(size<little_map::type>::value == 1); /* Failure */

 I have traced the problem to the file boost/mpl/map/aux_/item.hpp in the
 class definition of m_item. m_item derives from Base (which is a map<...>
 type) but does not define a "typedef m_item type;" to act as a unary
 metafunction returning itself. The result is that Base::type is found
 instead which means that m_item acts as a unary metafunction returning a
 map with all the inserted elements removed. The class m_item_ at the
 bottom of the file properly defines a "typedef m_item_ type;" which
 strengthens my belief that it missing from m_item is a bug.

 The solution, quite staightforwardly is to simply add the line "typedef
 m_item type;" to the class' definition.

 It should be noted that I am running version 1.48 of Boost, but have
 checked http://www.boost.org/doc/libs/1_52_0/boost/mpl/map/aux_/item.hpp
 and it still lacks the define so I'm convinced that this problem will
 still be there when I download the latest version of boost.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8749>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC