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 says true_type, periodt. ✨
  • using propagate_on_container_move_assignment = true_type β€” propagates on container move assignment, and it's set to true_type. πŸ’«
  • typedef size_t size_type β€” size type, it's a size_t. πŸ“
  • typedef _Tp value_type β€” value type is literally _Tp. πŸ‘‘

πŸ’… Public Member Functions πŸ’…

  • constexpr allocator (const allocator &__a) noexcept β€” copy constructor, constexpr and noexcept, no drama. 🫢
  • template<typename _Tp1 > constexpr allocator (const allocator< _Tp1 > &) noexcept β€” templated converting constructor, also constexpr and noexcept. 🧚
  • constexpr _Tp * allocate (size_t __n) β€” allocate! takes size_t __n, returns _Tp *, and it's constexpr. πŸ”₯
  • _Tp * allocate (size_type __n, const void *=static_cast< const void * >(0)) β€” the second allocate, with size_type __n and the exact const void *=static_cast< const void * >(0) bit. yes bestie, copy it exactly. 😭
  • constexpr void deallocate (_Tp *__p, size_t __n) β€” deallocate, takes _Tp *__p and size_t __n, returns void, constexpr. πŸ’€
  • allocator & operator= (const allocator &)=default β€” copy assignment, defaulted. no cap. πŸ’–

🫢 Friends 🫢

  • constexpr bool operator== (const allocator &, const allocator &) noexcept β€” equality operator for two allocators, constexpr, noexcept. πŸ“

(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, constexpr and noexcept, 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