std::pmr::m...do_allocate(3)
π NAME π
Okay so bestie, this page is std::pmr::memory_resource::do_allocate β and yes, the NAME line is basically <pink>std::pmr::memory_resource::do_allocate</pink> dash <pink>std::pmr::memory_resource::do_allocate</pink> again. Iconic redundancy, no notes π
.
The manual name folded in near the top is C++ Standard Libary (spelling exactly like the header, no cap ππ«Ά). Page vibes: std::pmr::memory_resource::do_allocate(3).
β¨ Synopsis β¨
The signature is exactly this, bestie:
virtual void* do_allocate( std::size_t bytes, std::size_t alignment )
It's marked (since C++17), and it ends with = 0; β yes, that = 0; is literally part of the synopsis, not a typo πΈ.
What it does: allocates storage with a size of at least bytes bytes, aligned to the specified alignment.
And the rule that is not playing around: alignment shall be a power of two. Periodt π₯.
π Exceptions π
Throws an exception if storage of the requested size and alignment cannot be obtained. That's the exception lore, and it's giving "handle it or catch feelings" π.
π©Ή Defect reports π©Ή
The following behavior-changing defect reports were applied retroactively to previously published C++ standards:
- DR:
LWG 2843β Applied to:C++17β Behavior as published: contradictory β Correct behavior: handling of unsupported alignment throws an exception.
π See also π
allocateβ allocates memory (public member function)
π That's the page, bestie. Source/version: http://cppreference.com Β· date: 2024.06.10 β now go forth and allocate with main-character energy π
β¨
π¦ 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