__GNU_CXX::BITMAP_ALLOCATOR(3cxx)

πŸ’– __gnu_cxx::bitmap_allocator< _Tp > β€” a.k.a. the 3cxx manual page, bestie edition πŸŽ€

okay so. welcome to the <bitmap_allocator.h> glow-up ✨ this page lives in the 3cxx manual, and it's all about one very extra, very iconic class template. let's get into it.


🌸 NAME 🌸

__gnu_cxx::bitmap_allocator< _Tp > β€” Bitmap Allocator, primary template. that's her. that's the whole vibe. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

first thing you do, always:

#include <bitmap_allocator.h>

she Inherits __gnu_cxx::free_list. periodt. family tree established 🫢

πŸ‘‘ Public Types

no cap, the type list is giving full wardrobe:

  • typedef free_list::__mutex_type __mutex_type
  • typedef const _Tp * const_pointer
  • typedef const _Tp & const_reference
  • typedef std::ptrdiff_t difference_type
  • typedef _Tp * pointer
  • typedef std::true_type propagate_on_container_move_assignment
  • typedef _Tp & reference
  • typedef std::size_t size_type
  • typedef _Tp value_type

✨ Public Member Functions

the actual main characters, in order, as listed:

  • bitmap_allocator (const bitmap_allocator &) noexcept
  • template<typename _Tp1 > bitmap_allocator (const bitmap_allocator< _Tp1 > &) noexcept
  • pointer _M_allocate_single_object () β€” Allocates memory for a single object of size sizeof(_Tp). πŸ“
  • void _M_deallocate_single_object (pointer __p) throw () β€” Deallocates memory that belongs to a single object of size sizeof(_Tp).
  • const_pointer address (const_reference __r) const noexcept
  • pointer address (reference __r) const noexcept
  • pointer allocate (size_type __n)
  • pointer allocate (size_type __n, typename bitmap_allocator< void >::const_pointer)
  • template<typename _Up , typename... _Args> void construct (_Up *__p, _Args &&... __args)
  • void deallocate (pointer __p, size_type __n) throw ()
  • template<typename _Up > void destroy (_Up *__p)
  • size_type max_size () const noexcept

🌈 Detailed Description 🌈

like, here's the actual declaration, verbatim, no edits:

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

and the official description is literally just: "Bitmap Allocator, primary template." short. sweet. ate. πŸ’€


πŸ’œ Member Function Documentation πŸ’œ

🧚 template<typename _Tp > pointer __gnu_cxx::bitmap_allocator< _Tp >::_M_allocate_single_object () [inline]

Allocates memory for a single object of size sizeof(_Tp).

Exceptions: std::bad_alloc. If memory cannot be allocated. 😭 (so, y'know, handle that.)

Complexity: Worst case complexity is O(N), but that is hardly ever hit. If and when this particular case is encountered, the next few cases are guaranteed to have a worst case complexity of O(1)! That's why this function performs very well on average. You can consider this function to have a complexity referred to commonly as: Amortized Constant time. slay, amortized constant time πŸŽ€

References __gnu_cxx::__detail::__bit_allocate(), __gnu_cxx::__detail::__num_bitmaps(), and __gnu_cxx::_Bit_scan_forward().

🌸 template<typename _Tp > void __gnu_cxx::bitmap_allocator< _Tp >::_M_deallocate_single_object (pointer __p) [inline]

Deallocates memory that belongs to a single object of size sizeof(_Tp). Complexity: O(lg(N)), but the worst case is not hit often! This is because containers usually deallocate memory close to each other and this case is handled in O(1) time by the deallocate function. iykyk πŸ’…

References __gnu_cxx::__detail::__bit_free(), __gnu_cxx::__detail::__num_bitmaps(), and __gnu_cxx::free_list::_M_insert().


⭐ Author ⭐

Generated automatically by Doxygen for libstdc++ from the source code. not a human, just a robot doing its little thing πŸ€–πŸ’–


heads up bestie: the class declarations, signatures, throw () specs, noexcepts and complexity notations above are all shown exactly as the page states them β€” don't go "fixing" them, fr fr πŸ™ˆ

and that's the page!! πŸ¦‹ thanks for reading, mwah πŸ’‹ β€” this one's from the libstdc++ source (the header/footer lines were the 3cxx manual name and that libst… truncated footer tag), all generated automatically by Doxygen for libstdc++ from the source code. see you in the next manpage, bestie πŸŽ€βœ¨