STD::PMR_POLYMORPHIC_ALLOCATOR(3cxx)
π std::pmr::polymorphic_allocator< _Tp > β a.k.a. the libstdc++ (3cxx) page
okay so bestie, sit down, we're talking about std::pmr::polymorphic_allocator< _Tp > from the <memory_resource> world π this is the class template polymorphic_allocator, and yes it's giving main character energy in the C++17 polymorphism scene.
β¨ NAME β¨
std::pmr::polymorphic_allocator< _Tp > β Class template polymorphic_allocator. that's it, that's the name, no cap π
π¦ SYNOPSIS π¦
#include <memory_resource>
πΈ Public Types πΈ
using value_type = _Tpβ the type it allocates, literally the whole personality π«Ά
π Public Member Functions π
polymorphic_allocator (const polymorphic_allocator &__other)=defaultβ copy constructor, defaulted, doing exactly what you'd expect, iconictemplate<typename _Up > polymorphic_allocator (const polymorphic_allocator< _Up > &__x) noexceptβ converting constructor from anotherpolymorphic_allocator< _Up >, and it'snoexceptso it will not be dramatic about itpolymorphic_allocator (memory_resource *__r) noexceptβ build one from amemory_resource *__r, alsonoexceptπ_Tp * allocate (size_t __n)β gimme__nof_Tp, hands you a_Tp *β¨void * allocate_bytes (size_t __nbytes, size_t __alignment=alignof(max_align_t))β raw bytes mode,__nbytesof them, with__alignmentdefaulting toalignof(max_align_t)template<typename _Up > _Up * allocate_object (size_t __n=1)β allocates_Upobjects,__ndefaults to1(you get one, bestie π)template<typename _Tp1 , typename... _Args> void construct (_Tp1 *__p, _Args &&... __args)β constructs at__pwith__args..., the classicvoid deallocate (_Tp *__p, size_t __n) noexceptβ gives back__nof_Tpat__p,noexcept, no tearsvoid deallocate_bytes (void *__p, size_t __nbytes, size_t __alignment=alignof(max_align_t))β returns raw bytes: pointer__p,__nbytes,__alignmentdefaulting toalignof(max_align_t)template<typename _Up > void deallocate_object (_Up *__p, size_t __n=1)β gives back__n_Upobjects at__p,__ndefaults to1template<typename _Up > void delete_object (_Up *__p)β destroys and deallocates the_Upat__pin one lil move πtemplate<typename _Up > void destroy (_Up *__p)β just destroys the_Upat__p, nothing moretemplate<typename _Up , typename... _CtorArgs> _Up * new_object (_CtorArgs &&... __ctor_args)β allocates and constructs a_Upfrom__ctor_args..., a whole combo meal πpolymorphic_allocator & operator= (const polymorphic_allocator &)=deleteβ assignment is deleted. yes bestie, it's gone, you cannot assign, that's not a bug that's the design πmemory_resource * resource () const noexceptβ hands you thememory_resource *,noexcept, the source of truthpolymorphic_allocator select_on_container_copy_construction () const noexceptβ the special copy-construction hook,noexcept, returns apolymorphic_allocator
π§ Friends π§
bool operator== (const polymorphic_allocator &__a, const polymorphic_allocator &__b) noexceptβ compares two of these bad boys,noexcept, returnsboolπ
π₯ Detailed Description π₯
template<typename _Tp>
class std::pmr::polymorphic_allocator< _Tp >
so the actual text is: "Class template polymorphic_allocator." β short, sweet, mysterious, we love a low-word-count legend π
Since: C++17 β (yes, C++17, that's the era, that's the vibe)
π«Ά Author π«Ά
Generated automatically by Doxygen for libstdc++ from the source code. not a human, just Doxygen doing its lil thing π€π
aaaand that's the page! π¦ this gem came to you from libstdc++, the source is the source code itself, and the lovely Doxygen generated it β big thank you to the std::pmr::polymorphic_allocator< _Tp >(3cxx) manual page, mwah π periodt.
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms