- memory[meta header]
- std[meta namespace]
- class[meta id-type]
- cpp11[meta cpp]
namespace std {
struct allocator_arg_t {}; // (1) C++11
struct allocator_arg_t { explicit allocator_arg_t() = default; }; // (1) C++17
constexpr allocator_arg_t allocator_arg = allocator_arg_t(); // (2) C++11
inline constexpr allocator_arg_t allocator_arg{}; // (2) C++17
}allocator_arg_tは、実装を持たない空のクラスである。
このクラスは、コンストラクタや関数のオーバーロードを行う際に一意な型として使用される。tupleやpromise、functionなどのコンストラクタではこのクラスを第一引数として第二引数以降にアロケータを設定している。
allocator_arg_t型の変数allocator_argが定義されている。
- C++11
- Clang: ?
- GCC: 4.7.0 [mark verified]
- Visual C++: 2012 [mark verified], 2013 [mark verified]
std::tupleクラスstd::promiseクラスstd::functionクラス
- LWG Issue 1073. Declaration of
allocator_argshould beconstexpr- C++11で、
allocator_argの宣言がconstからconstexprへ改められた
- C++11で、
- LWG Issue 1403. Inconsistent definitions for
allocator_arg- C++11で、ヘッダの概要とクラスの規定とで
allocator_argの宣言が食い違っていた問題が解消され、どちらもconstexprに統一された
- C++11で、ヘッダの概要とクラスの規定とで
- LWG Issue 2510. Tag types should not be
DefaultConstructible- C++17で、
{}による暗黙構築を防ぐため、明示的なデフォルトコンストラクタ(explicit allocator_arg_t() = default;)が追加された
- C++17で、