std::pmr::m...ce::allocate(3)
π std::pmr::m...ce::allocate(3) π
okay bestie, this is the C++ Standard Libary manual page for the allocation hook on std::pmr::memory_resource. itβs giving βlow-level but make it polymorphic.β π
β¨ NAME β¨
std::pmr::memory_resource::allocate β std::pmr::memory_resource::allocate
π¦ Synopsis π¦
(since C++17) β yep, this oneβs been hanging out since C++17. π«Ά
(until C++20) it looked like this:
void* allocate( std::size_t bytes,
std::size_t alignment = alignof(std::max_align_t) );
(since C++20) itβs got the [[nodiscard]] glow-up:
[[nodiscard]] void* allocate( std::size_t bytes,
std::size_t alignment = alignof(std::max_align_t) );
So what does it do? It allocates storage with a size of at least bytes bytes, aligned to the specified alignment. β¨
Equivalent to return do_allocate(bytes, alignment);.
π Exceptions π
It throws an exception if storage of the requested size and alignment cannot be obtained. no cap, if it canβt get the storage, itβs throwing hands π
π§ Defect reports π§
The following behavior-changing defect reports were applied retroactively to previously published C++ standards.
- DR:
LWG 2843; Applied to:???; Behavior as published: over-alignment was allowed to be unsupported; Correct behavior: alignment must be honoured.
π See also π
do_allocateallocates memory β[virtual](virtual private member function).
made with love from the source/version at http://cppreference.com, dated 2024.06.10, for the page std::pmr::m...ce::allocate(3) ππΈ
π¦ 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