std::scoped...ator_adaptor(3)
hey bestie π«Ά you're on the std::scoped...ator_adaptor(3) page from the C++ Standard Libary (that's the manual name, typed exactly like that here π
), and we're about to make these constructors make sense. no cap. β¨
πΈ NAME πΈ
std::scoped_allocator_adaptor::scoped_allocator_adaptor β the constructor for std::scoped_allocator_adaptor, and yes its name is literally std::scoped_allocator_adaptor::scoped_allocator_adaptor again. iconic echo behavior ππ
β¨ Synopsis β¨
Defined in header <scoped_allocator>.
scoped_allocator_adaptor(); // (1) (since C++11)
template< class OuterA2 >
scoped_allocator_adaptor(
OuterA2&& outerAlloc, const InnerAllocs&... innerAllocs
) noexcept; // (2) (since C++11)
scoped_allocator_adaptor(
const scoped_allocator_adaptor& other
) noexcept; // (3) (since C++11)
scoped_allocator_adaptor(
scoped_allocator_adaptor&& other
) noexcept; // (4) (since C++11)
template< class OuterA2 >
scoped_allocator_adaptor(
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other
) noexcept; // (5) (since C++11)
template< class OuterA2 >
scoped_allocator_adaptor(
scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other
) noexcept; // (6) (since C++11)
Now the six overloads, in order, no skipping, bestie:
- Default constructor: value-initializes the
OuterAllocbase class and the inner allocator member object, if used by the implementation. (since C++11) - Constructs the base class
OuterAllocfromstd::forward<OuterA2>(outerAlloc), and the inner allocators withinnerAllocs....This overload participates in overload resolution only ifstd::is_constructible<OuterAlloc, OuterA2>::valueistrue. (since C++11) - Copy-constructor: initializes each allocator from the corresponding allocator of
other. (since C++11) - Move-constructor: moves each allocator from the corresponding allocator of
otherinto*this. (since C++11) - Initializes each allocator from the corresponding allocator of
other. This overload participates in overload resolution only ifstd::is_constructible<OuterAlloc, const OuterA2&>::valueistrue. (since C++11) - Initializes each allocator from the corresponding allocator of
other, using move semantics. This overload participates in overload resolution only ifstd::is_constructible<OuterAlloc, OuterA2>::valueistrue. (since C++11)
π Parameters π
outerAllocβ constructor argument for the outer allocator. π«ΆinnerAllocs...β constructor arguments for the inner allocators. β¨otherβ anotherstd::scoped_allocator_adaptor. π
π©Ή Defect reports π©Ή
The following behavior-changing defect reports were applied retroactively to previously published C++ standards. lowkey important to know π§
- DR:
LWG 2782β Applied to:C++11β Behavior as published: constructors takingOuterA2weren't constrained, interfering with metaprogramming β Correct behavior: constraint added. πβ¨
π See also π
allocateβ allocates uninitialized storage using the outer allocator (public member function).constructβ constructs an object in allocated storage, passing the inner allocator to construct its constructor if appropriate (public member function).
mwah π that's the whole page, bestie. sourced from http://cppreference.com, version/date 2024.06.10, and the page is std::scoped...ator_adaptor(3). slay π
π¦ 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