STD::__DETAIL::_MAP_BASE(3cxx)

πŸ’– std::__detail::_Map_base ✨

okay bestie, buckle up, because this one is a deep cut β€” like, we're in the __detail namespace, which is basically the group chat nobody's supposed to screenshot. it's a libstdc++ internal (the 3cxx manual, so you know it's giving C++ standard library energy), and it's the sneaky little base class that makes your unordered_map go brrr. 🫢


🌸 NAME 🌸

std::__detail::_Map_base< _Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, _Unique_keys > β€” literally just the whole template parameter list as a name, no cap. that's the vibe here. πŸ’…


✨ SYNOPSIS ✨

first thing's first, the include, and yes it's a detail header so be normal about it:

#include <hashtable_policy.h>

πŸ‘‘ Inherited by

this thing is the mother of a whole nepo-baby lineup, bestie. the following all inherit from it:

  • std::_Hashtable< _Key, _Tp, _Hash, _Pred, allocator< std::pair< const _Key, _Tp > > >
  • std::_Hashtable< _Key, _Tp, hash< _Key >, equal_to< _Key >, allocator< std::pair< const _Key, _Tp > > >
  • std::_Hashtable< _Value, hash< _Value >, equal_to< _Value >, allocator< _Value > >
  • and std::_Hashtable< _Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits >

like, four whole _Hashtables claiming this as their ancestor?? iconic. generational talent fr fr. 🌈


πŸ’œ Detailed Description πŸ’œ

so here's the actual declaration, and yes we're reading it exactly as written, every typename accounted for:

template<typename _Key, typename _Value, typename _Alloc, typename
    _ExtractKey, typename _Equal, typename _H1, typename _H2, typename
    _Hash, typename _RehashPolicy, typename _Traits, bool _Unique_keys =
    _Traits::__unique_keys::value>
    struct std::__detail::_Map_base< _Key, _Value, _Alloc, _ExtractKey,
    _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, _Unique_keys >"Primary
    class template _Map_base.

the official summary is literally "Primary class template _Map_base." β€” short, sweet, main character energy. periodt. ✨

now for the tea, the part that actually matters: πŸ“

  • if the hashtable's value type is of the form pair<T1, T2>, and its key extraction policy (_ExtractKey) returns the first part of that pair β€” then boom, the hashtable gets a mapped_type typedef. yes bestie, that's where mapped_type comes from. you're welcome.
  • if it satisfies both of those criteria and it also has unique keys, then it also gets an operator[]. that's right β€” operator[] is a privilege, not a right, and it's reserved for the unique-keys girlies only. 😭
lowkey important: both of those perks are conditional. no pair value type or no first-part key extraction, and mapped_type says bye. add non-unique keys to the mix and operator[] ghosts you entirely. πŸ’€

πŸŽ€ Author πŸŽ€

Generated automatically by Doxygen for libstdc++ from the source code.

i cannot with the fact that nobody hand-wrote this β€” it's Doxygen doing its thing, and honestly? slay, automated queen. πŸ€–πŸ’–


and that's the whole page, bestie!! this was std::__detail::_Map_base< ... _Unique_keys > from the 3cxx manual β€” a libstdc++ internal, generated by Doxygen straight from the source code, footer and all (yes, the footer got a lil mangled into libststd::__detail::... _Unique_keys >(3cxx), we don't talk about it πŸ™ˆ). go forth and let your hashtables inherit responsibly. mwah. πŸ’‹βœ¨

πŸ“¦ where this page comes from