std::alloca...ts::max_size(3)
β¨ NAME β¨
okay so bestie, this is the std::alloca...ts::max_size(3) page from the C++ Standard Libary manual π
β and the NAME is literally std::allocator_traits::max_size β std::allocator_traits::max_size. yes, iconically redundant, we love that for us π.
πΈ Synopsis πΈ
Defined in header <memory>:
static size_type max_size( const Alloc& a ) noexcept;
(since C++11) (until C++20)
static constexpr size_type max_size( const Alloc& a ) noexcept;
(since C++20)
So here's the tea β: if possible, this obtains the maximum theoretically possible allocation size from the allocator a, by calling a.max_size().
If the above is not possible β like, say, Alloc does not have the member function max_size() β then it returns std::numeric_limits<size_type>::max() / sizeof(value_type). no cap, that's the fallback π«.
π Parameters π
aβ allocator to detect π
π¦ Return value π¦
Theoretical maximum allocation size. periodt π .
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards. yes, we're going back in time, main character energy π°οΈβ¨.
- LWG 2162, applied to C++11 β behavior as published:
max_sizewas not βrequiedβ to benoexcept(their spelling, not mine π); correct behavior: required. - LWG 2466, applied to C++11 β behavior as published: the theoretical maximum allocation size in bytes was returned as the fallback; correct behavior: the size in elements is returned. slay for correctness π.
π See also π
max_sizeβ returns the largest supported allocation size (until C++20) (public member function ofstd::allocator<T>) π
okay that's the whole vibe π β footer tea: this page is from http://cppreference.com, version date 2024.06.10, and the page tag is std::alloca...ts::max_size(3). mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms