mirror of
https://github.com/boostorg/container.git
synced 2026-01-26 09:12:35 +01:00
40451e4bf70b5813b4990adfdffe31f9ae0fc419
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.
Description
STL-like containers from Boost
Languages
C++
92.1%
C
7.7%
CMake
0.2%