__GNU_PBDS::GP_HASH_TABLE(3cxx)
π bestie's guide to __gnu_pbds::gp_hash_table (3cxx manual page) π
πΈ NAME πΈ
okay so the NAME line is this absolute unit of a template signature, and we are keeping every character exactly:
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >
β¨ SYNOPSIS β¨
bestie, it all starts with this include:
#include <assoc_container.hpp>
and it Inherits this exact thing:
Inherits __gnu_pbds::basic_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, Tag, Policy_Tl, _Alloc >.
π Public Types π
typedef Comb_Probe_Fn comb_probe_fntypedef gp_hash_tag container_categorytypedef Eq_Fn eq_fntypedef Hash_Fn hash_fntypedef Probe_Fn probe_fntypedef Resize_Policy resize_policy
π Public Member Functions π
gp_hash_table ()β Default constructor.gp_hash_table (const gp_hash_table &other)β exactly as listed; the source doesn't give this one an extra one-liner.gp_hash_table (const hash_fn &h)β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object.gp_hash_table (const hash_fn &h, const eq_fn &e)β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object, andr_eq_fnwill be copied by theeq_fnobject of the container object.gp_hash_table (const hash_fn &h, const eq_fn &e, const comb_probe_fn &cp)β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object,r_eq_fnwill be copied by theeq_fnobject of the container object, andr_comb_probe_fnwill be copied by thecomb_probe_fnobject of the container object.gp_hash_table (const hash_fn &h, const eq_fn &e, const comb_probe_fn &cp, const probe_fn &p)β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object,r_eq_fnwill be copied by theeq_fnobject of the container object,r_comb_probe_fnwill be copied by thecomb_probe_fnobject of the container object, andr_probe_fnwill be copied by theprobe_fnobject of the container object.gp_hash_table (const hash_fn &h, const eq_fn &e, const comb_probe_fn &cp, const probe_fn &p, const resize_policy &rp)β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object,r_eq_fnwill be copied by theeq_fnobject of the container object,r_comb_probe_fnwill be copied by thecomb_probe_fnobject of the container object,r_probe_fnwill be copied by theprobe_fnobject of the container object, andr_resize_policywill be copied by theResize_Policyobject of the container object.template<typename It > gp_hash_table (It first, It last)β Constructor taking__iteratorsto a range ofvalue_types. Thevalue_typesbetweenfirst_itandlast_itwill be inserted into the container object.template<typename It > gp_hash_table (It first, It last, const hash_fn &h)β Constructor taking__iteratorsto a range ofvalue_typesand some policy objects. Thevalue_typesbetweenfirst_itandlast_itwill be inserted into the container object.r_hash_fnwill be copied by thehash_fnobject of the container object.template<typename It > gp_hash_table (It first, It last, const hash_fn &h, const eq_fn &e)β Constructor taking__iteratorsto a range ofvalue_typesand some policy objects. Thevalue_typesbetweenfirst_itandlast_itwill be inserted into the container object.r_hash_fnwill be copied by thehash_fnobject of the container object, andr_eq_fnwill be copied by theeq_fnobject of the container object.template<typename It > gp_hash_table (It first, It last, const hash_fn &h, const eq_fn &e, const comb_probe_fn &cp)β Constructor taking__iteratorsto a range ofvalue_typesand some policy objects. Thevalue_typesbetweenfirst_itandlast_itwill be inserted into the container object.r_hash_fnwill be copied by thehash_fnobject of the container object,r_eq_fnwill be copied by theeq_fnobject of the container object, andr_comb_probe_fnwill be copied by thecomb_probe_fnobject of the container object.template<typename It > gp_hash_table (It first, It last, const hash_fn &h, const eq_fn &e, const comb_probe_fn &cp, const probe_fn &p)β Constructor taking__iteratorsto a range ofvalue_typesand some policy objects. Thevalue_typesbetweenfirst_itandlast_itwill be inserted into the container object.r_hash_fnwill be copied by thehash_fnobject of the container object,r_eq_fnwill be copied by theeq_fnobject of the container object,r_comb_probe_fnwill be copied by thecomb_probe_fnobject of the container object, andr_probe_fnwill be copied by theprobe_fnobject of the container object.template<typename It > gp_hash_table (It first, It last, const hash_fn &h, const eq_fn &e, const comb_probe_fn &cp, const probe_fn &p, const resize_policy &rp)β Constructor taking__iteratorsto a range ofvalue_typesand some policy objects. Thevalue_typesbetweenfirst_itandlast_itwill be inserted into the container object.r_hash_fnwill be copied by thehash_fnobject of the container object,r_eq_fnwill be copied by theeq_fnobject of the container object,r_comb_probe_fnwill be copied by thecomb_probe_fnobject of the container object,r_probe_fnwill be copied by theprobe_fnobject of the container object, andr_resize_policywill be copied by theresize_policyobject of the container object.gp_hash_table & operator= (const gp_hash_table &other)β exactly as listed.void swap (gp_hash_table &other)β exactly as listed.
π Detailed Description π
template<typename Key , typename Mapped , typename Hash_Fn = typename detail::default_hash_fn<Key>::type, typename Eq_Fn = typename detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn = detail::default_comb_hash_fn::type, typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool Store_Hash = detail::default_store_hash, typename _Alloc = std::allocator<char>>
class __gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >
A general-probing hash-based associative container.
π Template Parameters π
Keyβ Key type.Mappedβ Map type.Hash_Fnβ Hashing functor.Eq_Fnβ Equal functor.Comb_Probe_Fnβ Combining probe functor. IfHash_Fnis notnull_type, then this is the ranged-probe functor; otherwise, this is the range-hashing functor.XXXSeeDesign::Hash-Based Containers::Hash Policies.Probe_Fnβ Probe functor.Resize_Policyβ Resizes hash.Store_Hashβ Indicates whether the hash value will be stored along with each key. IfHash_Fnisnull_type, then the container will not compile if this value istrue._Allocβ Allocator type.
π¨ real talk: thatStore_Hashline is a hard compile-time no ifHash_Fnisnull_typeandStore_Hashistrue. Not a vibe, bestie.
Base tag choices are: gp_hash_tag.
Base is basic_hash_table.
π₯ Constructor & Destructor Documentation π₯
every constructor doc below is wrapped in this exact template head (same one every time, fr fr):
template<typename Key , typename Mapped , typename Hash_Fn = typename detail::default_hash_fn<Key>::type, typename Eq_Fn = typename detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn = detail::default_comb_hash_fn::type, typename Probe_Fn = typename detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy = typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool Store_Hash = detail::default_store_hash, typename _Alloc = std::allocator<char>>
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table () [inline]β Default constructor.__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (const hash_fn & h) [inline]β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object.__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (const hash_fn & h, const eq_fn & e) [inline]β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object, andr_eq_fnwill be copied by theeq_fnobject of the container object.__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (const hash_fn & h, const eq_fn & e, const comb_probe_fn & cp) [inline]β Constructor taking some policy objects.r_hash_fnwill be copied by thehash_fnobject of the container object,r_eq_fnwill be copied by theeq_fnobject of the container object, andr_comb_probe_fnwill be copied by thecomb_probe_fnobject of the container object.
okay so the constructor list keeps going, and honestly each one is just βbuild a gp_hash_table and copy these policy objects into itβ with different amounts of stuff. hereβs the full lineup, no skips, no cap π
tiny heads up: the docs keep sayingr_hash_fn,r_eq_fn, etc. even when the actual parameter names areh,e,cp,p,rp. donβt let that jump-scare you π«Ά
1. the four-policy constructor π
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (const hash_fn & h, const eq_fn & e, const comb_probe_fn & cp, const probe_fn & p) [inline]
constructor taking some policy objects. r_hash_fn gets copied by the hash_fn object of the container object, r_eq_fn gets copied by the eq_fn object of the container object, r_comb_probe_fn gets copied by the comb_probe_fn object of the container object, and r_probe_fn gets copied by the probe_fn object of the container object. itβs giving βpass me your policies, iβll keep them safeβ β¨
2. the five-policy constructor with a resize policy π¦
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (const hash_fn & h, const eq_fn & e, const comb_probe_fn & cp, const probe_fn & p, const resize_policy & rp) [inline]
constructor taking some policy objects. r_hash_fn gets copied by the hash_fn object of the container object, r_eq_fn gets copied by the eq_fn object of the container object, r_comb_probe_fn gets copied by the comb_probe_fn object of the container object, r_probe_fn gets copied by the probe_fn object of the container object, and r_resize_policy gets copied by the Resize_Policy object of the container object. yes bestie, now the resize policy is invited to the group chat too π
3. iterator range constructor, no extra policies πΈ
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
template<typename It >
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (It first, It last) [inline]
constructor taking __iterators to a range of value_types. the value_types between first_it and last_it will be inserted into the container object. literally βgive me a range and iβll stuff it inβ energy π
4. iterator range plus a hash function π§
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
template<typename It >
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (It first, It last, const hash_fn & h) [inline]
constructor taking __iterators to a range of value_types and some policy objects. the value_types between first_it and last_it will be inserted into the container object. r_hash_fn will be copied by the hash_fn object of the container object. so itβs range insert plus one little policy bestie π«Ά
5. iterator range plus hash and equality functions π
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
template<typename It >
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (It first, It last, const hash_fn & h, const eq_fn & e) [inline]
constructor taking __iterators to a range of value_types and some policy objects. the value_types between first_it and last_it will be inserted into the container object. r_hash_fn will be copied by the hash_fn object of the container object, and r_eq_fn will be copied by the eq_fn object of the container object. hash bestie and equality bestie both get copied, slay β¨
6. iterator range plus hash, equality, and comb-probe policies π₯
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
template<typename It >
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (It first, It last, const hash_fn & h, const eq_fn & e, const comb_probe_fn & cp) [inline]
constructor taking __iterators to a range of value_types and some policy objects. the value_types between first_it and last_it will be inserted into the container object. r_hash_fn will be copied by the hash_fn object of the container object, r_eq_fn will be copied by the eq_fn object of the container object, and r_comb_probe_fn will be copied by the comb_probe_fn object of the container object. three policy besties, all copied, all iconic π
7. iterator range plus hash, equality, comb-probe, and probe policies π
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
template<typename It >
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (It first, It last, const hash_fn & h, const eq_fn & e, const comb_probe_fn & cp, const probe_fn & p) [inline]
constructor taking __iterators to a range of value_types and some policy objects. the value_types between first_it and last_it will be inserted into the container object. r_hash_fn will be copied by the hash_fn object of the container object, r_eq_fn will be copied by the eq_fn object of the container object, r_comb_probe_fn will be copied by the comb_probe_fn object of the container object, and r_probe_fn will be copied by the probe_fn object of the container object. the probe policy is here, and it ate π
8. iterator range plus all the policies, including resize π
template<typename Key , typename Mapped , typename Hash_Fn = typename
detail::default_hash_fn<Key>::type, typename Eq_Fn = typename
detail::default_eq_fn<Key>::type, typename Comb_Probe_Fn =
detail::default_comb_hash_fn::type, typename Probe_Fn = typename
detail::default_probe_fn<Comb_Probe_Fn>::type, typename Resize_Policy =
typename detail::default_resize_policy<Comb_Probe_Fn>::type, bool
Store_Hash = detail::default_store_hash, typename _Alloc =
std::allocator<char>>
template<typename It >
__gnu_pbds::gp_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Probe_Fn, Probe_Fn, Resize_Policy, Store_Hash, _Alloc >::gp_hash_table (It first, It last, const hash_fn & h, const eq_fn & e, const comb_probe_fn & cp, const probe_fn & p, const resize_policy & rp) [inline]
constructor taking __iterators to a range of value_types and some policy objects. the value_types between first_it and last_it will be inserted into the container object. r_hash_fn will be copied by the hash_fn object of the container object, r_eq_fn will be copied by the eq_fn object of the container object, r_comb_probe_fn will be copied by the comb_probe_fn object of the container object, r_probe_fn will be copied by the probe_fn object of the container object, and r_resize_policy will be copied by the resize_policy object of the container object. full policy loadout, no notes, periodt π
π Author π
Generated automatically by Doxygen for libstdc++ from the source code.
and thatβs the whole constructor saga, bestie. the footer tag is libst__gnu_pbds::gp_..._Hash, _Alloc >(3cxx) β thatβs the source/version/date line doing its cryptic little thing. slay, bye β¨π«Ά
π¦ 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