STD::__DETAIL::_HASHTABLE_ALLOC(3cxx)
π NAME π
std::__detail::_Hashtable_alloc< _NodeAlloc > β bestie, this is the behind-the-scenes allocator brain of the libstdc++ hashtables, and we're gonna get to know her. (This page lives in manual section 3cxx, iykyk. π)
β¨ SYNOPSIS β¨
First things first, you gotta pull her in:
#include <hashtable_policy.h>
She inherits std::__detail::_Hashtable_ebo_helper< 0, _NodeAlloc >. Lowkey iconic lineage tbh. π¦
And she's inherited by β no cap, all three of these are <private> about it:
std::_Hashtable< _Key, _Tp, _Hash, _Pred, allocator< std::pair< const _Key, _Tp > > >[private]std::_Hashtable< _Key, _Tp, hash< _Key >, equal_to< _Key >, allocator< std::pair< const _Key, _Tp > > >[private]std::_Hashtable< _Value, hash< _Value >, equal_to< _Value >, allocator< _Value > >[private]
π Public Types π
These are the little aliases she keeps in her purse, fr fr:
__bucket_alloc_traitsβ =std::allocator_traits< __bucket_alloc_type >__bucket_alloc_typeβ =__alloc_rebind< __node_alloc_type, __bucket_type >__bucket_typeβ =__node_base *__node_alloc_traitsβ =__gnu_cxx::__alloc_traits< __node_alloc_type >__node_alloc_typeβ =_NodeAlloc__node_baseβ =__detail::_Hash_node_base__node_typeβ =typename _NodeAlloc::value_type__value_alloc_traitsβ =typename __node_alloc_traits::template rebind_traits< typename __node_type::value_type >
πΈ Public Member Functions πΈ
The whole roster, and yes, every single one is staying. Periodt. π
template<typename _Alloc > _Hashtable_alloc (_Alloc &&__a)β the constructy one, takes a forwarding-ref allocator._Hashtable_alloc (_Hashtable_alloc &&)=defaultβ move constructor, defaulted, she just glides on over._Hashtable_alloc (const _Hashtable_alloc &)=defaultβ copy constructor, defaulted, twin energy.__bucket_type * _M_allocate_buckets (std::size_t __bkt_count)β gets you buckets,__bkt_countof them.template<typename... _Args> __node_type * _M_allocate_node (_Args &&... __args)β mints a node out of__args....template<typename... _Args> auto _M_allocate_node (_Args &&... __args) -> __node_type *β same node-minting gig, written in the trailing-return-type fit. Both versions are listed, so both versions get their moment. βvoid _M_deallocate_buckets (__bucket_type *, std::size_t __bkt_count)β releases the buckets,__bkt_countof them.void _M_deallocate_node (__node_type *__n)β frees the single node__n.void _M_deallocate_node_ptr (__node_type *__n)β frees the pointer-to-node__n, slightly different flavor.void _M_deallocate_nodes (__node_type *__n)β plural! she's doing the whole chain starting at__n.__node_alloc_type & _M_node_allocator ()β hands you back the node allocator, mutable flavor.const __node_alloc_type & _M_node_allocator () constβ same allocator, const flavor, she's just being respectful of your constness. π«Ά
π DETAILED DESCRIPTION π
template<typename _NodeAlloc>
struct std::__detail::_Hashtable_alloc< _NodeAlloc >
Quote her directly, bestie:
"This type deals with all allocation and keeps an allocator instance through inheritance to benefit from EBO when possible."
So basically: she handles all the allocation, and she holds onto an allocator instance through inheritance so she can flex that EBO (empty base optimization) whenever the opportunity shows up. Main character allocation behavior, honestly. π₯
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. Not a human author β a robot did her makeup. π€π
And that's the whole page, bestie β straight outta libstdc++'s 3cxx manual, filed under std::__detail:...c< _NodeAlloc >(3cxx) in all her gloriously truncated footer-name beauty. Go allocate something cute. πβ¨
π¦ where this page comes from
- ubuntu noble: libstdc++-10-doc 10.5.0-4ubuntu2
- ubuntu noble: libstdc++-10-doc 10.5.0-4ubuntu2.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms