Skip to main content

std::allocator_arg

Defined inmemory
Since C++17
inline constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t();
Since C++11
struct allocator_arg_t { explicit allocator_arg_t() = default; };

constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t(); // Until C++17

std::allocator_arg_t is an empty class type used to disambiguate the overloads of constructors and member functions of allocator-aware objects, including std::tuple, std::function, std::packaged_task, (until C++17)and std::promise. std::allocator_arg is a constant of it.

Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DRApplied toBehavior as publishedCorrect behavior
LWG 2510C++11the default constructor was non-explicit, which could lead to ambiguitymade explicit

std::allocator_arg

Defined inmemory
Since C++17
inline constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t();
Since C++11
struct allocator_arg_t { explicit allocator_arg_t() = default; };

constexpr std::allocator_arg_t allocator_arg = std::allocator_arg_t(); // Until C++17

std::allocator_arg_t is an empty class type used to disambiguate the overloads of constructors and member functions of allocator-aware objects, including std::tuple, std::function, std::packaged_task, (until C++17)and std::promise. std::allocator_arg is a constant of it.

Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

DRApplied toBehavior as publishedCorrect behavior
LWG 2510C++11the default constructor was non-explicit, which could lead to ambiguitymade explicit