Mehdi Amini 40451e4bf7 Add variant of map constructors to avoid useless extra allocator copy when using initializer list
Many existing constructors have this form:

  map(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a = allocator_type())

The issue is that a temporary allocator_type is constructed, and
passed to the base class where it is used to copy-constructed the
rebound allocator.
This temporary allocator_type here is always destroyed at the end
of the map() constructor. For stateful allocators this is not
desirable.
The solution is to adopt what libc++ is doing and have to constructors:

  map(std::initializer_list<value_type> il, const Compare& comp = Compare(), const allocator_type& a)

and

  map(std::initializer_list<value_type> il, const Compare& comp = Compare())

This way, unless an allocator is provided by the client, no extra temporary
creation/destruction occurs.
2017-05-08 12:39:06 -07:00
2016-07-31 23:02:52 +02:00
2014-08-18 14:58:08 +01:00
2014-05-28 15:50:13 +02:00
Description
STL-like containers from Boost
18 MiB
Languages
C++ 92.1%
C 7.7%
CMake 0.2%