std::allocator_traits<Alloc>::max_size
来自cppreference.com
                    
                                        
                    < cpp | memory | allocator traits
                    
                                                            
                    |   在标头  <memory> 定义
  | 
||
|   static size_type max_size( const Alloc& a ) noexcept;  | 
 (C++11 起)  (C++20 前)  | 
|
|   static constexpr size_type max_size( const Alloc& a ) noexcept;  | 
(C++20 起) | |
若可能,则通过调用 a.max_size() ,从 a 获得最大理论可行的分配大小。
若上述行为不可行(例如 Alloc 无成员函数 max_size() ),则返回 std::numeric_limits<size_type>::max() / sizeof(value_type) 。
参数
| a | - | 要检测的分配器 | 
返回值
理论最大分配大小。
缺陷报告
下列更改行为的缺陷报告追溯地应用于以前出版的 C++ 标准。
| 缺陷报告 | 应用于 | 出版时的行为 | 正确行为 | 
|---|---|---|---|
| LWG 2162 | C++11 |  不要求 max_size 为 noexcept
 | 
已要求 | 
| LWG 2466 | C++11 | 后备情况下返回按字节计的理论最大分配大小 | 返回按元素计的大小 | 
参阅
|    (C++17 中弃用)(C++20 中移除)  | 
  返回最大的受支持分配大小  ( std::allocator<T> 的公开成员函数)  |