Namespaces
Variants
Views
Actions

std::allocator_traits::select_on_container_copy_construction

From cppreference.com
< cpp‎ | memory‎ | allocator traits
Revision as of 17:41, 2 November 2012 by P12bot (Talk | contribs)

Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <memory>
</td>

<td></td> <td></td> <tr class="t-dcl ">

<td >
static Alloc select_on_container_copy_construction( const Alloc& a )
</td>

<td class="t-dcl-nopad"> </td> <td > (since C++11) </td> </tr> Template:ddcl list end

If possible, obtains the copy-constructed version of the allocator a, by calling a.select_on_container_copy_construction(). If the above is not possible (e.g. a does not have the member function select_on_container_copy_construction(), then returns a, unmodified.

This function is called by the copy constructors of all standard library containers. It allows the allocator used by the constructor's argument to become aware that the container is being copied and modify state if necessary.

Parameters

a - allocator used by a standard container passed as an argument to a container copy constructor


Return value

The allocator to use by the the copy-constructed standard containers.

See also

Template:cpp/memory/scoped allocator adaptor/dcl list select on container copy construction