public static member function
<memory>

std::allocator_traits::max_size

static size_type max_size (allocator_type& alloc);
static size_type max_size (const allocator_type& alloc) noexcept;
Maximum size possible to allocate
Returns the maximum number of elements that could be allocated with allocator alloc.

Still, there is no guarantee that a later call to allocate with that value will succeed.

In the non-specialized definition of allocator_traits, this member function returns alloc.max_size() if such an expression is well formed. Otherwise, it returns numeric_limits<size_type>::max(). A specialization for a specific allocator type may provide a different definition.

Parameters

alloc
Allocator object
allocator_type is an alias of allocator_traits's template parameter.

Return value

The number of elements that might be allocated as maximum by a call to allocator_traits::allocate with alloc.
size_type is a membert type of allocator_traits.

See also