std::array<T,N>::max_size - cppreference.com (original) (raw)

| constexpr size_type max_size() const noexcept; | | (since C++11) | | ------------------------------------------------ | | ------------- |

Returns the maximum number of elements the container is able to hold.

[edit] Return value

Maximum number of elements, i.e. N.

[edit] Complexity

Constant.

[edit] Notes

Because each std::array<T, N> is a fixed-size container, the value returned by max_size equals N (which is also the value returned by size()).

[edit] Example

Output:

p.max_size() = 10 = 0xA q.max_size() = 10 = 0xA

See also

| | returns the number of elements (public member function) [edit] | | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |