STD::__DETAIL::_INSERT(3cxx)

✨ NAME ✨

okay bestie, say hi to std::__detail::_Insert< _Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, _Constant_iterators > πŸ’–

it lives in the 3cxx manual, aka the libstdc++ section, and it's one of those deep-in-the-vaults internals that does the actual heavy lifting for your hash tables. no cap.


πŸŽ€ SYNOPSIS πŸŽ€

inherited by these absolute icons:

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, it's the blueprint the hash tables are built on top of. the way that it's four different _Hashtable specializations pulling up to the same parent? mother behavior, fr fr. 🫢


πŸ¦‹ Detailed Description πŸ¦‹

okay so here's the actual declaration, look at all these template parameters bestie:

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

so Primary class template _Insert πŸ’… β€” and what it does is defines insert member functions that depend on _Hashtable policies, via partial specializations.

that's it. that's the whole job. it's the insert machinery, and the exact shape of that machinery gets decided by whatever the _Hashtable policies say. partial specializations do the switching. lowkey elegant honestly. ✨

ngl, the fact that _Constant_iterators defaults to _Traits::__constant_iterators::value is doing a lot of work here. it's giving "the policies already decided, I'm just following orders" energy. πŸ™ˆ

πŸ‘‘ Author πŸ‘‘

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

(yes bestie, a robot wrote this. no human typed these words. Doxygen said "I got it" and we all just accepted it. 😭)


okay that's the whole page, mwah πŸ’‹ β€” this was libstd + the 3cxx manual, straight out of libstdc++, generated by Doxygen and living its best life in the source tree. go forth and let the hash tables insert things, you're doing amazing sweetie πŸŽ€πŸ¦‹β­

πŸ“¦ where this page comes from