std::bad_array_length - cppreference.com

##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::bad_array_length

From cppreference.com
< cpp‎ | memory‎ | new

Defined in header `<new>` |  |
class bad_array_length : public std::bad_alloc; |  | (since C++14)

`std::bad_array_length` is the type of the object thrown as exceptions by the constructors of arrays of runtime bound and objects of type std::dynarray to report invalid array lengths if

1) array length is negative or equal to zero (for arrays of runtime bound)
2) total size of the new array would exceed implementation-defined maximum value (for both arrays of runtime bound and std::dynarray)

| This section is incomplete Reason: inheritance diagram

### [edit] Member functions

(constructor) | constructs the `bad_array_length` object (public member function)

# std::bad_array_length::bad_array_length

bad_array_length(); |  | (since C++14)

Constructs new exception object.

### Parameters

(none)

### Exceptions

`noexcept` specification:
noexcept

## Inherited from std::bad_alloc

## Inherited from std::exception

### Member functions

(destructor) [virtual] | destructs the exception object (virtual public member function of `std::exception`) [edit]
what [virtual] | returns an explanatory string (virtual public member function of `std::exception`) [edit]

### [edit] Notes

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

### [edit] Example

| This section is incomplete Reason: no example

### [edit] See also

bad_array_new_length (C++11) | exception thrown on allocation of array with invalid length (class) [edit]

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/memory/new/bad_array_length&oldid=63949"
Categories:

- Todo with reason
- unconditionally noexcept
- Todo no example