std::alloca...onstruction(3)
πΈ NAME πΈ
std::allocator_traits::select_on_container_copy_construction - std::allocator_traits::select_on_container_copy_construction. Yep, the page says the same name on both sides of the dash, and honestly? iconic π
. This is the (3) page, straight outta the C++ Standard Libary manual (that's the manual name, spelling included, periodt). It's all about the allocator-traits moment where a container copy asks, "bestie, which allocator should I use?" β¨
β¨ Synopsis β¨
Defined in header <memory> π
static Alloc select_on_container_copy_construction( const Alloc& a );
(since C++11) (until C++20)
static constexpr Alloc select_on_container_copy_construction( const Alloc& a );
(since C++20)
Okay so if possible, obtains the copy-constructed version of the allocator a, by calling a.select_on_container_copy_construction(). π«Ά If the above is not possible (e.g. Alloc does not have the member function select_on_container_copy_construction()), then returns a, unmodified. No cap π.
This function is called by the copy constructors of all standard library containers. It allows the allocator used by the constructor's argument to become aware that the container is being copied and modify state if necessary. Main character allocator energy, fr fr π.
π Parameters π
aβ allocator used by a standard container passed as an argument to a container copy constructor π
π Return value π
The allocator to use by the copy-constructed standard containers. That's the whole vibe check β .
π¦ See also π¦
select_on_container_copy_construction(public member function ofstd::scoped_allocator_adaptor<OuterAlloc,InnerAlloc...>) β copies the state ofscoped_allocator_adaptorand all its allocators π§
Source/version/date sign-off: this page is from http://cppreference.com, with the 2024.06.10 date stamp. Stay allocator-aware and hydrated, bestie ππ
π¦ 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