名前空間
変種
操作

std::allocator_traits

提供: cppreference.com
< cpp‎ | memory
 
 
動的メモリ管理
スマートポインタ
(C++11)
(C++11)
(C++11)
(C++17未満)
(C++11)
アロケータ
allocator_traits
(C++11)
メモリリソース
未初期化記憶域
ガベージコレクションサポート
その他
(C++20)
(C++11)
(C++11)
C のライブラリ
低水準のメモリ管理
 
 
ヘッダ <memory> で定義
template< class Alloc >
struct allocator_traits;
(C++11以上)

allocator_traits クラステンプレートは Allocator の様々な性質にアクセスするための標準的な方法を提供します。 標準のコンテナおよびその他の標準ライブラリのコンポーネントはこのテンプレートを通してアロケータにアクセスします。 これにより、 allocator_traits のユーザ提供の特殊化が必要な機能をすべて実装している限り、任意のクラス型をアロケータとして使用することができます。

デフォルトの特殊化されていない allocator_traits は以下のメンバを持ちます。

目次

[編集] メンバ型

定義
allocator_type Alloc
value_type Alloc::value_type
pointer 存在すれば Alloc::pointer、そうでなければ value_type*
const_pointer 存在すれば Alloc::const_pointer、そうでなければ std::pointer_traits<pointer>::rebind<const value_type>
void_pointer 存在すれば Alloc::void_pointer、そうでなければ std::pointer_traits<pointer>::rebind<void>
const_void_pointer 存在すれば Alloc::const_void_pointer、そうでなければ std::pointer_traits<pointer>::rebind<const void>
difference_type 存在すれば Alloc::difference_type、そうでなければ std::pointer_traits<pointer>::difference_type
size_type 存在すれば Alloc::size_type、そうでなければ std::make_unsigned<difference_type>::type
propagate_on_container_copy_assignment 存在すれば Alloc::propagate_on_container_copy_assignment、そうでなければ std::false_type
propagate_on_container_move_assignment 存在すれば Alloc::propagate_on_container_move_assignment、そうでなければ std::false_type
propagate_on_container_swap 存在すれば Alloc::propagate_on_container_swap、そうでなければ std::false_type
is_always_equal(C++17以上) 存在すれば Alloc::is_always_equal、そうでなければ std::is_empty<Alloc>::type

[編集] メンバエイリアステンプレート

定義
rebind_alloc<T> 存在すれば Alloc::rebind<T>::other、そうでなくこの Alloc が Alloc<U, Args> であれば Alloc<T, Args>
rebind_traits<T> std::allocator_traits<rebind_alloc<T>>

[編集] メンバ関数

[静的]
アロケータを使用して未初期化記憶域を確保します
(パブリック静的メンバ関数) [edit]
[静的]
アロケータを使用して記憶域を解放します
(パブリック静的メンバ関数) [edit]
[静的]
確保された記憶域にオブジェクトを構築します
(関数テンプレート) [edit]
[静的]
確保された記憶域に格納されているオブジェクトを破棄します
(関数テンプレート) [edit]
[静的]
アロケータでサポートされている最大オブジェクトサイズを返します
(パブリック静的メンバ関数) [edit]
標準コンテナをコピーした後で使用するためのアロケータを取得します
(パブリック静的メンバ関数) [edit]

[編集] 関連項目

デフォルトのアロケータ
(クラステンプレート) [edit]
多段コンテナのための多段アロケータを実装します
(クラステンプレート) [edit]
ポインタライクな型に関する情報を提供します
(クラステンプレート) [edit]