__GNU_CXX::MALLOC_ALLOCATOR(3cxx)

πŸ’– NAME πŸ’–

__gnu_cxx::malloc_allocator< _Tp > β€” an allocator that uses malloc. bestie. that's literally it. that's the whole vibe.

(this page lives in section 3cxx of the manual, iykyk πŸ’…)


✨ SYNOPSIS ✨

#include <malloc_allocator.h>

🌸 Public Types 🌸

  • typedef std::ptrdiff_t difference_type β€” the type you use for distances between pointers, standard-issue πŸŽ€
  • typedef std::true_type propagate_on_container_move_assignment β€” yes, this container does propagate on container move assignment, her little true_type said so πŸ’…
  • typedef std::size_t size_type β€” the type for sizes and counts, classic
  • typedef _Tp value_type β€” the thing being allocated is _Tp, main character energy πŸ‘‘

πŸ¦‹ Public Member Functions πŸ¦‹

  • constexpr malloc_allocator (const malloc_allocator &) noexcept β€” copy constructor, constexpr, noexcept, zero drama ✨
  • template<typename _Tp1 > constexpr malloc_allocator (const malloc_allocator< _Tp1 > &) noexcept β€” the converting copy constructor, so you can build one from an allocator of a different type _Tp1. also constexpr, also noexcept. slay
  • _Tp * allocate (size_type __n, const void *=0) β€” hands you back _Tp *. takes __n and a second const void * argument that defaults to 0. this is where the malloc happens πŸ“
  • void deallocate (_Tp *__p, size_type) β€” gives the memory back. takes the pointer __p and a size. this is where the free happens 🧚

πŸŽ€ Friends πŸŽ€

  • template<typename _Up > constexpr bool operator== (const malloc_allocator &, const malloc_allocator< _Up > &) noexcept β€” the equality comparison between two malloc_allocators, and it's templated on _Up so the two sides can be different types. constexpr, noexcept, friendship confirmed 🫢

⭐ Detailed Description ⭐

template<typename _Tp>
    class __gnu_cxx::malloc_allocator< _Tp >

"An allocator that uses malloc." β€” that's the official tagline, no notes.

This is precisely the allocator defined in the C++ Standard. like, the actual one. no cap.

  • πŸ’€ all allocation calls malloc
  • πŸ’€ all deallocation calls free

and that's the entire personality. lowkey iconic, highkey simple.

bestie did you catch that β€” allocation = malloc, deallocation = free, exactly as the Standard defines. no extra spice, no hidden behaviour, just the two C functions doing their thing.

🌈 Author 🌈

Generated automatically by Doxygen for libstdc++ from the source code. (not me writing it by hand at 3am, the robots did it πŸ™ˆ)


okay that's the whole page, mwah πŸ’œ β€” this cutie was generated automatically by Doxygen for libstdc++ from the source code, and it's serving __gnu_cxx::malloc_allocator< _Tp > from the 3cxx section of the manual. go forth and allocate responsibly βœ¨πŸŽ€πŸ¦‹