__GNU_PBDS::DETAIL::GP_HT_MAP(3cxx)
π NAME π
__gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >
Okay bestie, say it with me: general-probing hash-based container π
. She lives in the 3cxx section of the manual (that's the C++ part of the man pages, iykyk), she's from libstdc++, and yes her name is eleven template parameters long. We respect her for it. No cap. π«Ά
πΈ SYNOPSIS πΈ
#include <gp_ht_map_.hpp>
She doesn't just show up alone, she comes with a whole entourage β she inherits from __gnu_pbds::detail::hash_eq_fn< Key, Eq_Fn, _Alloc, Store_Hash >, Resize_Policy, __gnu_pbds::detail::ranged_probe_fn< Key, Hash_Fn, _Alloc, Comb_Probe_Fn, Probe_Fn, Store_Hash >, and __gnu_pbds::detail::types_traits< Key, Mapped, _Alloc, Store_Hash >. Main character energy fr fr. π
β¨ Public Types β¨
Not me making a whole list of typedefs, but every single one matters, so here we go π
enum { store_hash }β Value stores hash, true or false.typedef _Alloc allocator_typeβ her allocator type βtypedef Comb_Probe_Fn comb_probe_fnβ the combining probe functor type π«typedef const_iterator_ const_iteratorβ read-only iterator vibes πtypedef traits_base::const_pointer const_pointertypedef traits_base::const_reference const_referencetypedef _Alloc::difference_type difference_typetypedef Eq_Fn eq_fnβ the equality functor typetypedef Hash_Fn hash_fnβ the hash functor typetypedef iterator_ iteratorβ the mutable iterator, slaytypedef traits_base::key_const_pointer key_const_pointertypedef traits_base::key_const_reference key_const_referencetypedef traits_base::key_pointer key_pointertypedef traits_base::key_reference key_referencetypedef traits_base::key_type key_typeβ the key, obviously πtypedef traits_base::mapped_const_pointer mapped_const_pointertypedef traits_base::mapped_const_reference mapped_const_referencetypedef traits_base::mapped_pointer mapped_pointertypedef traits_base::mapped_reference mapped_referencetypedef traits_base::mapped_type mapped_typeβ the mapped type, the other half of the ship π₯°typedef __nothrowcopy::indicator no_throw_indicatortypedef point_const_iterator_ point_const_iteratortypedef point_iterator_ point_iteratortypedef traits_base::pointer pointertypedef Probe_Fn probe_fntypedef traits_base::reference referencetypedef Resize_Policy resize_policytypedef _Alloc::size_type size_typetypedef integral_constant< int, Store_Hash > store_extratypedef stored_data< value_type, size_type, Store_Hash > stored_data_typetypedef traits_base::value_type value_type
Thirty-one types, all accounted for, we don't skip a single one in this house π β¨
π Public Member Functions π
gp_ht_map (const gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy > &)β the copy constructor, she copies herself iconicallygp_ht_map (const Hash_Fn &)β build one from just a hash functorgp_ht_map (const Hash_Fn &, const Eq_Fn &)β hash + equalitygp_ht_map (const Hash_Fn &, const Eq_Fn &, const Comb_Probe_Fn &)β hash + equality + combining probegp_ht_map (const Hash_Fn &, const Eq_Fn &, const Comb_Probe_Fn &, const Probe_Fn &)β add a probe functor to the mixgp_ht_map (const Hash_Fn &, const Eq_Fn &, const Comb_Probe_Fn &, const Probe_Fn &, const Resize_Policy &)β the full five-piece combo meal πiterator begin ()β start of the mutable iterator rangeconst_iterator begin () constβ start of the const iterator rangevoid clear ()β yeet everything out π§Ήtemplate<typename It > void copy_from_range (It, It)β copy from an iterator range, literallybool empty () constβ True ifsize() == 0.iterator end ()β end of the mutable iterator rangeconst_iterator end () constβ end of the const iterator rangebool erase (key_const_reference)β remove by keytemplate<typename Pred > size_type erase_if (Pred)β remove everything matching the predicate, and it tells you how many it gotpoint_iterator find (key_const_reference)β find by key, returns a point iteratorpoint_const_iterator find (key_const_reference) constβ same but constpoint_iterator find_end ()β the "not found" sentinel for point iteratorspoint_const_iterator find_end () constβ const version of said sentinelComb_Probe_Fn & get_comb_probe_fn ()β Return currentcomb_probe_fn.const Comb_Probe_Fn & get_comb_probe_fn () constβ Return current constcomb_probe_fn.Eq_Fn & get_eq_fn ()β Return currenteq_fn.const Eq_Fn & get_eq_fn () constβ Return current consteq_fn.Hash_Fn & get_hash_fn ()β Return currenthash_fn.const Hash_Fn & get_hash_fn () constβ Return current consthash_fn.Probe_Fn & get_probe_fn ()β Return currentprobe_fn.const Probe_Fn & get_probe_fn () constβ Return current constprobe_fn.Resize_Policy & get_resize_policy ()β Return currentresize_policy.const Resize_Policy & get_resize_policy () constβ Return current constresize_policy.std::pair< point_iterator, bool > insert (const_reference r_val)β insert a value, get back a point iterator plus a success flagsize_type max_size () constβ the absolute max she can holdmapped_reference operator[] (key_const_reference r_key)β subscript by key, the classic π―size_type size () constβ how many she's holding rnvoid swap (gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy > &)β trade contents with another map of the exact same type
π Public Attributes π
no_throw_indicator m_no_throw_copies_indicatorβ the no-throw copy indicator, she's got receiptsstore_extra m_store_extra_indicatorβ the store-extra indicator π
π¦ Friends π¦
class const_iterator_β bestie who gets to readclass iterator_β bestie who gets to read AND write π
π Detailed Description π
template<typename Key, typename Mapped, typename Hash_Fn, typename Eq_Fn,
typename _Alloc, bool Store_Hash, typename Comb_Probe_Fn, typename
Probe_Fn, typename Resize_Policy>
class __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn,
_Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >
She is a general-probing hash-based container. That's the whole assignment and she ate. π β¨
π Template Parameters π
Keyβ Key type.Mappedβ Map type.Hash_Fnβ Hashing functor. Default is__gnu_cxx::hash.Eq_Fnβ Equal functor. Defaultstd::equal_to<Key>_Allocβ Allocator type.Store_Hashβ If key type stores extra metadata. Defaults tofalse.Comb_Probe_Fnβ Combining probe functor. IfHash_Fnis notnull_type, then this is the ranged-probe functor; otherwise, this is the range-hashing functor. XXX See Design::Hash-Based Containers::Hash Policies. Defaultdirect_mask_range_hashing.Probe_Fnβ Probe functor. Defaults tolinear_probe_fn, alsoquadratic_probe_fn.Resize_Policyβ Resizes hash. Defaults tohash_standard_resize_policy, usinghash_exponential_size_policyandhash_load_check_resize_trigger.
Bases are: detail::hash_eq_fn, Resize_Policy, detail::ranged_probe_fn, detail::types_traits. (Optional: detail::debug_map_base.) β yes the optional base is real, don't come for her π
π Member Enumeration Documentation π
anonymous enum
template<typename Key , typename Mapped , typename Hash_Fn , typename Eq_Fn
, typename _Alloc , bool Store_Hash, typename Comb_Probe_Fn , typename
Probe_Fn , typename Resize_Policy >
Value stores hash, true or false. That's it, that's the enum π
π₯ Member Function Documentation π₯
Okay so every single one of these entries ships with the same enormous template prefix, and I'm not typing it twelve times just to flex β here it is once, at the top, applying to all of them, periodt:
template<typename Key , typename Mapped , typename Hash_Fn , typename Eq_Fn
, typename _Alloc , bool Store_Hash, typename Comb_Probe_Fn , typename
Probe_Fn , typename Resize_Policy >
Now the actual functions, all fully scoped, nothing dropped π«Ά
bool __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::empty () const[inline]β True ifsize() == 0.Comb_Probe_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_comb_probe_fn ()β Return currentcomb_probe_fn.const Comb_Probe_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_comb_probe_fn () constβ Return current constcomb_probe_fn.Eq_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_eq_fn ()β Return currenteq_fn.const Eq_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_eq_fn () constβ Return current consteq_fn.Hash_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_hash_fn ()β Return currenthash_fn.const Hash_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_hash_fn () constβ Return current consthash_fn.Probe_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_probe_fn ()β Return currentprobe_fn.const Probe_Fn & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_probe_fn () constβ Return current constprobe_fn.Resize_Policy & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_resize_policy ()β Return currentresize_policy.const Resize_Policy & __gnu_pbds::detail::gp_ht_map< Key, Mapped, Hash_Fn, Eq_Fn, _Alloc, Store_Hash, Comb_Probe_Fn, Probe_Fn, Resize_Policy >::get_resize_policy () constβ Return current constresize_policy.
Eleven entries, every single getter present and accounted for, ngl that's a lot of getters but she's thorough π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code. (Doxygen really said "I'll write the docs for you bestie" and honestly? we stan an automated queen π€β¨)
And that's the whole page! This copy is from the libstdc++ docs (that's the source/version, don't ask me for a date, it's giving mysterious π), and we love her for it. Go build something iconic with your hash map, bestie β slay ππ₯π
π¦ where this page comes from
- debian trixie: libstdc++-12-doc 12.4.0-5
- debian trixie: libstdc++-13-doc 13.3.0-16
- debian trixie: libstdc++-14-doc 14.2.0-19
- ubuntu noble: libstdc++-10-doc 10.5.0-4ubuntu2
- ubuntu noble: libstdc++-10-doc 10.5.0-4ubuntu2.1
- ubuntu noble: libstdc++-11-doc 11.4.0-9ubuntu1
- ubuntu noble: libstdc++-11-doc 11.5.0-1ubuntu1~24.04.1
- ubuntu noble: libstdc++-12-doc 12.3.0-17ubuntu1
- ubuntu noble: libstdc++-12-doc 12.4.0-2ubuntu1~24.04.1
- ubuntu noble: libstdc++-13-doc 13.2.0-23ubuntu4
- ubuntu noble: libstdc++-13-doc 13.3.0-6ubuntu2~24.04.1
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- ubuntu noble: libstdc++-14-doc 14.2.0-4ubuntu2~24.04.1
- ubuntu questing: libstdc++-11-doc 11.5.0-7ubuntu1
- ubuntu questing: libstdc++-11-doc 11.5.0-7ubuntu1.1
- ubuntu questing: libstdc++-12-doc 12.5.0-6ubuntu1
- ubuntu questing: libstdc++-13-doc 13.4.0-4ubuntu1
- ubuntu questing: libstdc++-14-doc 14.3.0-8ubuntu1
- ubuntu questing: libstdc++-15-doc 15.2.0-4ubuntu4
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms