Opened 3 years ago

Closed 2 years ago

#11820 closed Bugs (fixed)

compilier error when using operator[] of map

Reported by: anonymous Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:


  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;


  1. 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[]

Change History (3)

comment:1 Changed 3 years ago by viboes

Component: Nonecontainer
Owner: set to Ion Gaztañaga

comment:2 Changed 3 years ago by Ion Gaztañaga

Thanks for the report. Can you check the following commit fixes your problem?

comment:3 Changed 2 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

Closed bug as no confirmation was obtained by the reporter.

Note: See TracTickets for help on using tickets.