std::experi...do_allocate(3)
π std::experimental::pmr::monotonic_buffer_resource::do_allocate
okay so real quick β this is a page from the C++ Standard Library manual, and we're talking about the std::experimental::pmr::monotonic_buffer_resource::do_allocate function. yes the name is a whole paragraph, we don't talk about it π
β¨ NAME β¨
std::experimental::pmr::monotonic_buffer_resource::do_allocate β like, literally the exact same thing again bestie, std::experimental::pmr::monotonic_buffer_resource::do_allocate. the manual is just being extra π
π¦ Synopsis
virtual void* do_allocate( std::size_t bytes, std::size_t alignment );
library fundamentals TS energy β¨
πΈ DESCRIPTION πΈ
It allocates storage. that's the whole vibe.
So here's the tea β β if the current buffer has enough unused space to fit a block with the specified size and alignment, then it allocates the return block right out of the current buffer. easy, no drama, ate π
Otherwise? it allocates a new buffer by calling upstream_resource()->allocate(n, m), where n is not less than the greater of bytes and the next buffer size, and m is not less than alignment. then it sets the new buffer as the current buffer, increases the next buffer size by an implementation-defined growth factor (which is not necessarily integral β yes that's a real caveat, don't come for me π), and then allocates the return block from the newly allocated buffer. main character energy fr fr π
π Return value
A pointer to allocated storage of at least bytes bytes in size, aligned to the specified alignment if such alignment is supported, and to alignof(std::max_align_t) otherwise. slay π«Ά
π₯ Exceptions
Throws nothing unless calling allocate() on the upstream memory resource throws. that's it, that's the whole rule π§
β See also
allocateβ allocates memory (public member function ofstd::experimental::pmr::memory_resource)do_allocate[virtual]β allocates memory (virtual protected member function ofstd::experimental::pmr::memory_resource)
π Category:
Noindexed pages
ngl the [virtual] tag on that second one is doing a lot of heavy lifting β it's a virtual protected member function, so mind your access, bestie π
okay that's the whole page, you're welcome π this one came straight from http://cppreference.com, dated 2024.06.10, from the std::experi...do_allocate(3) page β mwah, go allocate something responsibly β¨πΈ
π¦ 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