STD::PMR_POLYMORPHIC_ALLOCATOR(3)
π NAME π
std::pmr::polymorphic_allocator< _Tp > β bestie it's a Class template called polymorphic_allocator. That's the whole vibe. It's a template, it's polymorphic, it allocates, slay. β¨
(also hi, you're reading the Library Functions Manual page for it, section 3, we love a numbered-section moment π«Ά)
β¨ SYNOPSIS β¨
First things first, you gotta pull it in:
#include <memory_resource>
That's it. That's the include. No cap. π¦
π Public Types π
using value_typeβ the public type, just chillin' right there. Yes, that's genuinely all it says. Iconic minimalism. π
πΈ Public Member Functions πΈ
okay so here's the whole roster, every single one, no skipping, I promised:
polymorphic_allocator (const polymorphic_allocator &__other)=defaultβ copy constructor, and it's=default, so the compiler handles it and honestly? good for it.template<typename _Up> polymorphic_allocator (const polymorphic_allocator< _Up > &__x) noexceptβ converting constructor from apolymorphic_allocatorof a different type_Up.noexcept, so it will NOT be the one to betray you.polymorphic_allocator (memory_resource *__r) noexceptβ build one from amemory_resource *. Alsonoexcept. We love a constructor that keeps its promises. π«Ά_Tp * allocate (size_t __n)β gimme__nof them, hands back a_Tp *.template<typename _Tp1, typename... _Args> void construct (_Tp1 *__p, _Args &&... __args)β constructs a thing at__p, forwarding literally all the__args(it's a variadic, periodt).void deallocate (_Tp *__p, size_t __n) noexceptβ give the memory back.noexcept. bye! πtemplate<typename _Up> void destroy (_Up *__p)β destroys the_Upsitting at__p.polymorphic_allocator & operator= (const polymorphic_allocator &)=deleteβ π¨ DELETED. You cannot assign one to another. It's not a bug, it's a boundary. Respect the boundary bestie, the compiler will absolutely yell at you and it will be correct. πmemory_resource * resource () const noexceptβ hands you back thememory_resource *.const,noexcept, a whole green-flag king. πpolymorphic_allocator select_on_container_copy_construction () const noexceptβ the special little guy that decides what a container does when it gets copied.constandnoexcept, obviously, because it's that kind of method. β¨
π Friends π
bool operator== (const polymorphic_allocator &__a, const polymorphic_allocator &__b) noexceptβ equality comparison between two of them,noexcept, sitting here as a friend like the main character who doesn't need to be a member. π
π¦ Detailed Description π¦
so, template time:
template<typename _Tp>
class std::pmr::polymorphic_allocator< _Tp >
and the description is literally just:
Class template polymorphic_allocator.
that's it. that's the tea. short, sweet, self-assured. π
Since: C++17 β so if you're on C++17 or later, this is your moment. If you're not... bestie. π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. Not a human, not a girlie, just Doxygen doing its little robot thing. It ate, honestly. π€β¨
and that's the page! π
thanks for reading all the way to the bottom, you're a real one. this was the libstdc++ section 3 manual page for std::pmr::polymorphic_allocator< _Tp >, so go forth and allocate responsibly, mwah π«Άππ
π¦ 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