STD::__DETAIL::_HASHTABLE_EBO_HELPER(3cxx)

πŸ’– NAME πŸ’–

std::__detail::_Hashtable_ebo_helper< _Nm, _Tp, __use_ebo > β€” bestie, this is the lil helper struct that squeezes your empty types into zero extra bytes. it's giving ✨optimization✨, no cap.


🌸 SYNOPSIS 🌸

okay so it gets inherited by all of these, and every single one of them is a [private] inheritance, so this is strictly an internal-squad situation 🫢:

  • std::__detail::_Hashtable_alloc< __alloc_rebind< _Alloc, __detail::_Hash_node< _Value, _Traits::__hash_cached::value > > > [private]
  • std::__detail::_Hashtable_alloc< __alloc_rebind< _Hash, __detail::_Hash_node< _Tp, _Traits::__hash_cached::value > > > [private]
  • std::__detail::_Hashtable_alloc< __alloc_rebind< hash< _Key >, __detail::_Hash_node< _Tp, _Traits::__hash_cached::value > > > [private]
  • std::__detail::_Hashtable_alloc< __alloc_rebind< equal_to< _Value >, __detail::_Hash_node< hash< _Value >, _Traits::__hash_cached::value > > > [private]
  • std::__detail::_Hashtable_base< _Key, _Tp, _Pred, allocator< std::pair< const _Key, _Tp > >, _H1, _H2, _Hash, _Traits > [private]
  • std::__detail::_Hashtable_base< _Key, _Tp, equal_to< _Key >, allocator< std::pair< const _Key, _Tp > >, _H1, _H2, _Hash, _Traits > [private]

πŸ¦‹ Detailed Description πŸ¦‹

here's the whole vibe, template and all:

template<int _Nm, typename _Tp, bool __use_ebo = !__is_final(_Tp) && __is_empty(_Tp)>
struct std::__detail::_Hashtable_ebo_helper< _Nm, _Tp, __use_ebo >
Primary class template _Hashtable_ebo_helper.

the tea β˜•: it's a helper class that uses EBO (Empty Base Optimization, iykyk) when it is not forbidden β€” like, the type isn't final β€” and when it is worth it β€” meaning the type is empty. πŸŽ€

so basically: not final && empty = free real estate, and it takes it. iconic behaviour honestly πŸ’…


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for libstdc++ from the source code. bestie did not hand-write this, the robot did πŸ€–βœ¨


aaaand that's the whole page! πŸ’– this lil writeup lives in the libstdc++ manual, section 3cxx β€” mwah, go read the actual headers if you wanna see it in the wild πŸ¦‹πŸŒΈπŸ’œ

πŸ“¦ where this page comes from