Skip to content

Search topics & cppreference

Search all study topics, concept maps, and 6,587 C++ and C reference pages.

std::allocator<T>::max_size

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

NotebookLM
size_type max_size() const throw();
(until C++11)
size_type max_size() const noexcept;
(since C++11)
(deprecated in C++17)
(removed in C++20)

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.

See also

[static]
returns the maximum object size supported by the allocator
(public static member function of std::allocator_traits<Alloc>)

Content from this page on cppreference.com, licensed under CC-BY-SA 3.0 and GFDL. Modified: restyled, site navigation removed, code windows added. Offline snapshot of 9 February 2025.