Namespaces
Variants

std::allocator_traits<Alloc>:: select_on_container_copy_construction

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (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)
(C++11) (until C++23)
ヘッダーで定義 <memory>
static Alloc select_on_container_copy_construction ( const Alloc & a ) ;
(C++11以降)
(C++20以降constexpr)

可能であれば、アロケータ a のコピー構築バージョンを、 a. select_on_container_copy_construction ( ) を呼び出すことで取得します。上記が不可能な場合(例: Alloc がメンバ関数 select_on_container_copy_construction() を持たない場合)、変更されていない a を返します。

この関数は、すべての標準ライブラリコンテナのコピーコンストラクタによって呼び出されます。これにより、コンストラクタの引数で使用されるアロケータが、コンテナがコピーされていることを認識し、必要に応じて状態を変更することが可能になります。

パラメータ

a - コンテナコピーコンストラクタの引数として渡された標準コンテナによって使用されるアロケータ

戻り値

コピー構築された標準コンテナが使用するアロケータ。

関連項目

scoped_allocator_adaptorとそのすべてのアロケータの状態をコピーする
( std::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...> の公開メンバ関数)