Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/memory/allocator traits/select on container copy construction"

From cppreference.com
m (Shorten template names. Use {{lc}} where appropriate.)
m (Update links.)
Line 23: Line 23:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/memory/scoped_allocator_adaptor/dcl list select_on_container_copy_construction}}
+
{{dsc inc | cpp/memory/scoped_allocator_adaptor/dsc select_on_container_copy_construction}}
 
{{dsc end}}
 
{{dsc end}}
  

Revision as of 22:12, 31 May 2013

 
 
Dynamic memory management
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Allocators
Garbage collection support
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)
(C++11)(until C++23)



 
 
Defined in header <memory>
static Alloc select_on_container_copy_construction( const Alloc& a )
(since C++11)

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

copies the state of scoped_allocator_adaptor and all its allocators
(public member function of std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>) [edit]