STD::ALLOCATOR(3cxx)
std::allocator< _Tp > π β bestie page from the cxx manual β¨
okay so bestie, this is the page for std::allocator< _Tp >, and it lives in the cxx manual. It's giving "standard allocator, C++03 era, but make it iconic." Let's get into it. π
π NAME π
std::allocator< _Tp > β The standard allocator, as per C++03 [20.4.1]. π
β¨ SYNOPSIS β¨
#include <memory>
It inherits std::__new_allocator< _Tp >. slay. π¦
πΈ Public Types πΈ
typedef ptrdiff_t difference_typeβ the difference type, lowkey doing its typedef thing. πusing is_always_equal = true_typeβ always equal? the type saystrue_type, periodt. β¨using propagate_on_container_move_assignment = true_typeβ propagates on container move assignment, and it's set totrue_type. π«typedef size_t size_typeβ size type, it's asize_t. πtypedef _Tp value_typeβ value type is literally_Tp. π
π Public Member Functions π
constexpr allocator (const allocator &__a) noexceptβ copy constructor,constexprandnoexcept, no drama. π«Άtemplate<typename _Tp1 > constexpr allocator (const allocator< _Tp1 > &) noexceptβ templated converting constructor, alsoconstexprandnoexcept. π§constexpr _Tp * allocate (size_t __n)β allocate! takessize_t __n, returns_Tp *, and it'sconstexpr. π₯_Tp * allocate (size_type __n, const void *=static_cast< const void * >(0))β the second allocate, withsize_type __nand the exactconst void *=static_cast< const void * >(0)bit. yes bestie, copy it exactly. πconstexpr void deallocate (_Tp *__p, size_t __n)β deallocate, takes_Tp *__pandsize_t __n, returnsvoid,constexpr. πallocator & operator= (const allocator &)=defaultβ copy assignment, defaulted. no cap. π
π«Ά Friends π«Ά
constexpr bool operator== (const allocator &, const allocator &) noexceptβ equality operator for twoallocators,constexpr,noexcept. π
π Related Symbols π
(Note that these are not member symbols.)
template<typename _T1 , typename _T2 > constexpr bool operator== (const allocator< _T1 > &, const allocator< _T2 > &) noexceptβ the cross-type equality operator,constexprandnoexcept, not a member. iykyk. π
π¦ Detailed Description π¦
template<typename _Tp>
class std::allocator< _Tp >"The standard allocator, as per C++03 [20.4.1].
Wait, that quote mark after std::allocator< _Tp > is in the source, bestie. We're not fixing it, we're just reporting it. π
It's the standard allocator, as per C++03 [20.4.1]. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/memory.html#std.util.memory.allocator for further details. π₯
π Template Parameters π
_Tpβ Type of allocated object. that's the whole vibe. π
π€ Author π€
Generated automatically by Doxygen for libstdc++ from the source code. so not a human, but honestly still ate. π
π cute sign-off: source/version is libstdc++, page is std::allocator< _Tp >(3cxx). The footer didn't print a date, so we're not inventing one β it's timeless, 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