Namespaces
Variants

std::allocator<T>::max_size

来自 zh.cppreference.net
 
 
内存管理库
分配器
内存资源
未初始化存储 (直到 C++20*)
垃圾收集器支持 (直到 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> 的公开静态成员函数)