Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/memory/new/bad array new length"

From cppreference.com
< cpp‎ | memory‎ | new
m (link new-expr to language/new)
(fmt)
Line 20: Line 20:
 
===Member functions===
 
===Member functions===
 
{{dcl list begin}}
 
{{dcl list begin}}
{{dcl list mem ctor | cpp/memory/new/bad_array_new_length/bad_array_new_length | Constructs the bad_array_new_length object}}
+
{{dcl list mem ctor | cpp/memory/new/bad_array_new_length/bad_array_new_length | constructs the {{tt|bad_array_new_length}} object}}
 
{{dcl list end}}
 
{{dcl list end}}
  

Revision as of 08:30, 8 December 2011

Template:cpp/memory/new/sidebar Template:ddcl list begin <tr class="t-dsc-header">

<td>
Defined in header <new>
</td>

<td></td> <td></td> </tr> <tr class="t-dcl ">

<td >
class bad_array_new_length : public std::bad_alloc;
</td>

<td class="t-dcl-nopad"> </td> <td > Template:mark c++11 feature </td> </tr> Template:ddcl list end

std::bad_array_new_length is the type of the object thrown as exceptions by the new-expressions to report invalid array lengths if

1) array length is negative

2) total size of the new array would exceed implementation-defined maximum value

3) the number of initializer-clauses exceeds the number of elements to initialize

Only the first array dimension may generate this exception; dimensions other than the first are constant expressions and are checked at compile time.

Contents

Member functions

constructs the bad_array_new_length object
(public member function)

Inherited from std::bad_alloc

Member functions

Replaces a bad_alloc object
(public member function of std::bad_alloc)
Returns explanatory string
(public member function of std::bad_alloc)

Template:cpp/error/exception/exception/inherit

Notes

The override for the virtual member function what() may by provided, but is not required.

Example

Template:example cpp

See also

Template:cpp/memory/new/dcl list operator newTemplate:cpp/memory/new/dcl list bad alloc