Skip to main content

std::allocator<T>::max_size

Since C++11, Deprecated in C++17, Removed in C++20
size_type max_size() const noexcept;
Until C++11
size_type max_size() const throw();

Returns the maximum theoretically possible value of n, for which the call allocate(n, 0) could succeed.

In most implementations, this returns std::numeric_limits<size_type>::max() / sizeof(value_type).

Parameters

(none)

Return value

The maximum supported allocation size

std::allocator<T>::max_size

Since C++11, Deprecated in C++17, Removed in C++20
size_type max_size() const noexcept;
Until C++11
size_type max_size() const throw();

Returns the maximum theoretically possible value of n, for which the call allocate(n, 0) could succeed.

In most implementations, this returns std::numeric_limits<size_type>::max() / sizeof(value_type).

Parameters

(none)

Return value

The maximum supported allocation size