[Bug libstdc++/54075] [4.7.1] unordered_map insert still slower than 4.6.2

Jonathan Wakely jwakely.gcc@gmail.com
Fri Nov 23 22:22:00 GMT 2012

On 23 November 2012 21:59, François Dumont wrote:
> - To create a node I need to request the allocator twice, once for the node
> and an other time for the stored value. This is quite unusual so I don't
> know if it is a real problem

That's normal for node-based containers.

The correct behaviour (see 23.2.1  [container.requirements.general]
p3) is to use one allocator type to allocate memory for a node, but
*not* use that type to construct the node (instead use placement new),
then use a different allocator type to construct the element in the
node.  See _M_create_node in <bits/forward_list.h> for more details.

More information about the Libstdc++ mailing list