bsl::allocator_traits::select_on_container_copy_construction

Return the allocator to use when copy-constructing a container.

Synopsis

Declared in <bslma_allocatortraits.h>

static
ALLOCATOR_TYPE
select_on_container_copy_construction(ALLOCATOR_TYPE const& rhs);

Description

Return a copy of the allocator that should be used to copy- construct one container from another container whose allocator is the specified rhs. If the parameterized ALLOCATOR_TYPE defines a method select_on_container_copy_construction, this function returns the result of calling that method on rhs; otherwise, this method enforces the default policy of propagating the allocator on copy construction, as is standard practice for standard allocators (i.e., returns rhs). Note that the specialization of this class template for bsl::allocator (in the bslma_bslallocator component) provides the alternate default behavior of not propagating the allocator on copy construction (i.e., returning a default-constructed allocator object).

Return Value

allocator that should be used to copy-construct the container

Parameters

NameDescription
rhsallocator of the container being copy-constructed from