[#bsl-allocator_traits-0108-select_on_container_copy_construction]
= xref:bsl.adoc[bsl]::xref:bsl/allocator_traits-0108.adoc[allocator&lowbar;traits]::select&lowbar;on&lowbar;container&lowbar;copy&lowbar;construction
:relfileprefix: ../../
:mrdocs:

Return the allocator to use when copy&hyphen;constructing a container&period;

== Synopsis

Declared in `&lt;bslma&lowbar;allocatortraits&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
ALLOCATOR&lowbar;TYPE
select&lowbar;on&lowbar;container&lowbar;copy&lowbar;construction(ALLOCATOR&lowbar;TYPE const& rhs);
----

== Description

Return a copy of the allocator that should be used to copy&hyphen; construct one container from another container whose allocator is the specified `rhs`&period; If the parameterized `ALLOCATOR&lowbar;TYPE` defines a method `select&lowbar;on&lowbar;container&lowbar;copy&lowbar;construction`, this function returns the result of calling that method on `rhs`&semi; otherwise, this method enforces the default policy of propagating the allocator on copy construction, as is standard practice for standard allocators (i&period;e&period;, returns `rhs`)&period; Note that the specialization of this class template for `bsl&colon;&colon;allocator` (in the `bslma&lowbar;bslallocator` component) provides the alternate default behavior of _not_ propagating the allocator on copy construction (i&period;e&period;, returning a default&hyphen;constructed allocator object)&period;

== Return Value

allocator that should be used to copy&hyphen;construct the container

== Parameters

[cols="1,4"]
|===
| Name| Description
| *rhs*
| allocator of the container being copy&hyphen;constructed from
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
