__GNU_CXX::__MT_ALLOC(3)

πŸ’– NAME πŸ’–

__gnu_cxx::__mt_alloc< _Tp, _Poolp > β€” bestie, this is a fixed size (power of 2) allocator which β€” when compiled with thread support β€” will maintain one freelist per size per thread plus a global one. Steps are taken to limit the per thread freelist sizes (by returning excess back to the global list). ✨


✨ SYNOPSIS ✨

#include <mt_allocator.h>

Inherits __gnu_cxx::__mt_alloc_base< _Tp >. 🫢


πŸŽ€ Public Types πŸŽ€

  • typedef _Poolp __policy_type β€” the policy type, literally right there in the name πŸ’…
  • typedef _Poolp::pool_type __pool_type β€” the pool type, pulled straight off the policy
  • typedef const _Tp * const_pointer β€” pointer, but make it const 🧊
  • typedef const _Tp & const_reference β€” reference, but make it const
  • typedef std::ptrdiff_t difference_type β€” for when you gotta know the distance between two pointers, no cap
  • typedef _Tp * pointer β€” your classic pointer, iconic
  • typedef std::true_type propagate_on_container_move_assignment β€” yes, it propagates on container move assignment, periodt
  • typedef _Tp & reference β€” reference to _Tp, we love to see it
  • typedef std::size_t size_type β€” sizes, sizes, sizes 🌸
  • typedef _Tp value_type β€” the actual thing being allocated, the main character

πŸ¦‹ Public Member Functions πŸ¦‹

  • __mt_alloc (const __mt_alloc &) noexcept β€” copy constructor, and she's noexcept, as she should be πŸ‘‘
  • template<typename _Tp1, typename _Poolp1> __mt_alloc (const __mt_alloc< _Tp1, _Poolp1 > &) noexcept β€” the templated converting copy constructor, also noexcept πŸ”₯
  • const __pool_base::_Tune _M_get_options () β€” grab the current tuning options
  • void _M_set_options (__pool_base::_Tune __t) β€” set the tuning options to __t
  • const_pointer address (const_reference __x) const noexcept β€” hand over the address of a const __x
  • pointer address (reference __x) const noexcept β€” hand over the address of __x
  • pointer allocate (size_type __n, const void *=0) β€” allocate __n of the things, with that sneaky little const void *=0 hint param ✨
  • template<typename _Up, typename... _Args> void construct (_Up *__p, _Args &&... __args) β€” construct a _Up at __p, forwarding all the __args like the good little perfect-forwarder she is
  • void deallocate (pointer __p, size_type __n) β€” give it back, __n items from __p
  • template<typename _Up> void destroy (_Up *__p) β€” bye bye, __p πŸ’€
  • size_type max_size () const noexcept β€” the biggest size she can handle, and she's noexcept about it

🌸 Detailed Description 🌸

template<typename _Tp, typename _Poolp = __common_pool_policy<__pool, true>>
class __gnu_cxx::__mt_alloc< _Tp, _Poolp >
"This is a fixed size (power of 2) allocator which - when compiled with thread support - will maintain one freelist per size per thread plus a global one. Steps are taken to limit the per thread freelist sizes (by returning excess back to the global list).

Okay so the tea β˜•: every thread gets its own freelist per size, there's also one big global freelist, and the allocator is very careful not to let any single thread's freelists get out of hand β€” it sends the excess back to the global list. Vibe check: passed. 🌈

Further details, go read the lore yourself bestie:

https://gcc.gnu.org/onlinedocs/libstdc++/manual/mt_allocator.html


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. So like, nobody actually sat down and hand-wrote this, the robots did it. πŸ€–πŸ’–


That's the whole page, bestie β€” and yes, it came to you straight from libstdc++, the __gnu_cxx::..., _Poolp >(3) manual, iykyk. Go forth and allocate responsibly. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms