__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_typetypedef const _Tp * const_pointertypedef const _Tp & const_referencetypedef std::ptrdiff_t difference_typetypedef _Tp * pointertypedef std::true_type propagate_on_container_move_assignmenttypedef _Tp & referencetypedef std::size_t size_typetypedef _Tp value_type
β¨ Public Member Functions
the actual main characters, in order, as listed:
bitmap_allocator (const bitmap_allocator &) noexcepttemplate<typename _Tp1 > bitmap_allocator (const bitmap_allocator< _Tp1 > &) noexceptpointer _M_allocate_single_object ()β Allocates memory for a single object of sizesizeof(_Tp). πvoid _M_deallocate_single_object (pointer __p) throw ()β Deallocates memory that belongs to a single object of sizesizeof(_Tp).const_pointer address (const_reference __r) const noexceptpointer address (reference __r) const noexceptpointer 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 πβ¨
π¦ where this page comes from
- debian trixie: libstdc++-12-doc 12.4.0-5
- debian trixie: libstdc++-13-doc 13.3.0-16
- ubuntu noble: libstdc++-12-doc 12.3.0-17ubuntu1
- ubuntu noble: libstdc++-12-doc 12.4.0-2ubuntu1~24.04.1
- ubuntu noble: libstdc++-13-doc 13.2.0-23ubuntu4
- ubuntu noble: libstdc++-13-doc 13.3.0-6ubuntu2~24.04.1
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- ubuntu questing: libstdc++-12-doc 12.5.0-6ubuntu1
- ubuntu questing: libstdc++-13-doc 13.4.0-4ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms