std::allocator_arg(3)
π NAME π
okay so bestie, this is the std::allocator_arg(3) page from the C++ Standard Libary manual β yes, thatβs the manual name, folded right up here so we didnβt have to copy the header line, periodt. Itβs all about std::allocator_arg, the tiny helper that keeps overloads from fighting π
.
β¨ Synopsis β¨
Defined in header <memory> β literally right there in the synopsis, put it in your notes π
Defined in header <memory>
struct allocator_arg_t { explicit allocator_arg_t() = default; };
(since C++11)
constexpr std::allocator_arg_t allocator_arg =
(since C++11)
std::allocator_arg_t();
(until C++17)
inline constexpr std::allocator_arg_t allocator_arg =
(since C++17)
std::allocator_arg_t();
std::allocator_arg_t is an empty class type, and its whole main-character job is to disambiguate the overloads of constructors and member functions of allocator-aware objects π. That includes std::tuple, std::function, std::packaged_task, (until C++17) and std::promise β yes, the marker is sitting right there in the list, keep it exactly like that π. And std::allocator_arg is a constant of std::allocator_arg_t. Slay.
π Defect reports π
The following behavior-changing defect reports were applied retroactively to previously published C++ standards. Not me reading lore, but okay π
LWG 2510β applied toC++11; behavior as published: the default constructor was non-explicit, which could lead to ambiguity; correct behavior: made explicit. Iconic fix, fr fr β¨
π See also π
uses_allocatorβ checks if the specified type supports uses-allocator construction(C++11); itβs a class template π¦
Thatβs the whole vibe, bestie. Source/version: http://cppreference.com, dated 2024.06.10, and this page is std::allocator_arg(3) β byeee ππΈπ«Ά
π¦ 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