Difference between revisions of "cpp/memory/new/bad alloc"
From cppreference.com
m (+trivial example) |
(→Example: fmt) |
||
Line 25: | Line 25: | ||
#include <iostream> | #include <iostream> | ||
#include <new> | #include <new> | ||
+ | |||
int main() | int main() | ||
{ | { | ||
Line 37: | Line 38: | ||
Allocation failed: std::bad_alloc | Allocation failed: std::bad_alloc | ||
}} | }} | ||
− | |||
===See also=== | ===See also=== |
Revision as of 06:34, 8 December 2011
Template:cpp/memory/new/sidebar Template:ddcl list begin <tr class="t-dsc-header">
<td>Defined in header
</td>
<new>
<td></td> <td></td> </tr> <tr class="t-dcl ">
<td class="t-dcl-nopad">class bad_alloc : public std::exception;
</td>
<td class="t-dcl-nopad"> </td> <td class="t-dcl-nopad"> </td> </tr> Template:ddcl list end
std::bad_alloc
is the type of the object thrown as exceptions by the allocation functions to report failure to allocate storage.
Member functions
Constructs the bad_alloc object (public member function) | |
Replaces a bad_alloc object (public member function) | |
Returns explanatory string (public member function) |
Template:cpp/error/exception/exception/inherit