[Boost-bugs] [Boost C++ Libraries] #11820: compilier error when using operator[] of map

Subject: [Boost-bugs] [Boost C++ Libraries] #11820: compilier error when using operator[] of map
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-11-25 10:24:34


#11820: compilier error when using operator[] of map
-----------------------+------------------------------
 Reporter: anonymous | Type: Bugs
   Status: new | Milestone: To Be Determined
Component: None | Version: Boost 1.59.0
 Severity: Problem | Keywords:
-----------------------+------------------------------
 1. I've define a map with specific Allocator, map<key, value, less,
 MyAllocator>
 2. if I call operator[] of this map, it will not find the right allocator
 mapped_type& priv_subscript(BOOST_RV_REF(key_type) mk)
    {
       key_type &k = mk;
       //we can optimize this
       iterator i = this->lower_bound(k);
       // i->first is greater than or equivalent to k.
       if (i == this->end() || this->key_comp()(k, (*i).first)){
          container_detail::value_init<mapped_type> m;
          movable_value_type val(boost::move(k), boost::move(m.m_t));
          i = insert(i, boost::move(val));
       }
       return (*i).second;
    }

 3. because of this code " movable_value_type val(boost::move(k),
 boost::move(m.m_t)); "
 it will not new the right pair with right allocator when using operator[]

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11820>
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:19 UTC