std::nothrow_t

< cpp‎ | memory‎ | new
Defined in header <new>
struct nothrow_t {};
(until C++11)
struct nothrow_t { explicit nothrow_t() = default; };
(since C++11)

std::nothrow_t is an empty class type used to disambiguate the overloads of throwing and non-throwing allocation functions.

Defect reports

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

DR Applied to Behavior as published Correct behavior
LWG 2510 C++11 the default constructor was non-explicit, which could lead to ambiguity made explicit

See also

an object of type nothrow_t used to select an non-throwing allocation function
(constant)
allocation functions
(function)