Name
nothrow object — Requests null pointer return when out of memory
Synopsis
struct nothrow_t {};
extern const nothrow_t nothrow;
The nothrow
object is used
in placement new
expressions to
request that the new
operator
return a null pointer instead of throwing bad_alloc
if the memory allocation request
cannot be fulfilled.
The nothrow_t
type does not
do anything; it is used only in overloaded placement new
and delete
operators.
Note that nothrow
is also
accepted by overloaded operator
delete
for symmetry with new
. The nothrow
version of operator
delete
behaves just like the ordinary
operator
delete
. Like any placement delete
function, it is called only if the
placement new
expression throws
an exception.
See Also
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.