STD::PMR_MEMORY_RESOURCE(3)
π std::pmr::memory_resource β the whole vibe π
okay bestie, welcome to the libstdc++ Library Functions Manual, section 3 (that's the "library functions" shelf of the man page library, iykyk). today we're talking about std::pmr::memory_resource, and honestly? it's giving allocator royalty. π
β¨ NAME β¨
std::pmr::memory_resource β Class memory_resource.
like, that's it, that's the class. iconic behavior fr. π
πΈ SYNOPSIS πΈ
#include <memory_resource>
π‘ plot twist: this class gets inherited bystd::pmr::monotonic_buffer_resourceandstd::pmr::unsynchronized_pool_resource. so it's lowkey the mom friend of the polymorphic memory world. π«Ά
π Public Member Functions π
memory_resource (const memory_resource &)=default
void * allocate (size_t __bytes, size_t __alignment=_S_max_align)
void deallocate (void *__p, size_t __bytes, size_t
__alignment=_S_max_align)
bool is_equal (const memory_resource &__other) const noexcept
memory_resource & operator= (const memory_resource &)=default
lemme break that down for you, one by one:
memory_resource (const memory_resource &)=defaultβ the copy constructor, and it's=defaultso the compiler handles it, no drama, no custom code. πvoid * allocate (size_t __bytes, size_t __alignment=_S_max_align)β hand it some__bytesand a__alignment(which defaults to_S_max_align, she has a default, she's thoughtful like that) and it gives you back avoid *. β¨void deallocate (void *__p, size_t __bytes, size_t __alignment=_S_max_align)β the reverse: give back the pointer__p, the__bytes, and the__alignment(again defaulting to_S_max_align). what goes around comes around bestie. π¦bool is_equal (const memory_resource &__other) const noexceptβ compares you to__otherand returns abool. and yes she'sconstandnoexcept, because she's that girl. πmemory_resource & operator= (const memory_resource &)=defaultβ the copy assignment operator, also=default. compiler's got it, we don't lift a finger. π
π Detailed Description π
Class memory_resource.
that's the whole description, she said "less is more". π
β Since β
C++17
so like, if you're on anything older, bestie, it's not happening. sorry not sorry. π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
ngl it wasn't a human, it was a doc generator, and it ate. no cap. π₯
and that's the whole page!! footer said it's libstdc++, and it's page std::pmr::...ry_resource(3) β yes the title is truncated with dots, she's mysterious like that. π§ mwah, go allocate responsibly. πππΈ
π¦ where this page comes from
- arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
- fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- fedora 44: libstdc++-docs 16.2.1-2.fc44
- fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms