Namespaces
Variants

std::allocator<T>:: max_size

From cppreference.net
Memory management library
( exposition only* )
Allocators
Uninitialized memory algorithms
Constrained uninitialized memory algorithms
Memory resources
Uninitialized storage (until C++20)
( until C++20* )
( until C++20* )
( until C++20* )

Garbage collector support (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
(C++11) (until C++23)
size_type max_size ( ) const throw ( ) ;
(C++11 前)
size_type max_size ( ) const noexcept ;
(C++11 起)
(C++17 中弃用)
(C++20 中移除)

返回理论上可能的 n 的最大值,对此值调用 allocate ( n, 0 ) 可能成功。

在大多数实现中,这会返回 std:: numeric_limits < size_type > :: max ( ) / sizeof ( value_type )

参数

(无)

返回值

最大支持的分配大小。

参见

[static]
返回分配器支持的最大对象大小
( std::allocator_traits<Alloc> 的公开静态成员函数)