__GNU_PBDS::CC_HASH_TABLE(3cxx)
π NAME π
Header vibes: __gnu_pbds::cc..._Hash, _Alloc >, manual section (3cxx) β but the actual star of the show is __gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Hash_Fn, Resize_Policy, Store_Hash, _Alloc >. Bestie, this is the 3cxx manual page for GNU PBDS's collision-chaining hash-based associative container, and it is lowkey iconic. Part 1 of 2, keep your wig on. π
β¨ SYNOPSIS β¨
#include <assoc_container.hpp>
Inherits __gnu_pbds::basic_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Resize_Policy, Store_Hash, Tag, Policy_Tl, _Alloc >.
π Public Types π
typedef Comb_Hash_Fn comb_hash_fnβ the combining hash functor type, slaying under the namecomb_hash_fn.typedef cc_hash_tag container_categoryβ the container category tag, and it'scc_hash_tag.typedef Eq_Fn eq_fnβ the equality functor type, living aseq_fn.typedef Hash_Fn hash_fnβ the hashing functor type, akahash_fn.typedef Resize_Policy resize_policyβ the resize policy type, serving looks asresize_policy.
π Public Member Functions π
cc_hash_table ()β default constructor. No args, just main-character energy.cc_hash_table (const cc_hash_table &other)β copy constructor fromother.cc_hash_table (const hash_fn &h)β constructor taking some policy objects.r_hash_fnwill be copied by theHash_Fnobject of the container object.cc_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.cc_hash_table (const hash_fn &h, const eq_fn &e, const comb_hash_fn &ch)β 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_hash_fnwill be copied by thecomb_hash_fnobject of the container object.cc_hash_table (const hash_fn &h, const eq_fn &e, const comb_hash_fn &ch, 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_hash_fnwill be copied by thecomb_hash_fnobject of the container object, andr_resize_policywill be copied by theresize_policyobject of the container object.template<typename It > cc_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 > cc_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.template<typename It > cc_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 > cc_hash_table (It first, It last, const hash_fn &h, const eq_fn &e, const comb_hash_fn &ch)β 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_hash_fnwill be copied by thecomb_hash_fnobject of the container object.template<typename It > cc_hash_table (It first, It last, const hash_fn &h, const eq_fn &e, const comb_hash_fn &ch, 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_hash_fnwill be copied by thecomb_hash_fnobject of the container object, andr_resize_policywill be copied by theresize_policyobject of the container object.cc_hash_table & operator= (const cc_hash_table &other)β assignment operator fromother.void swap (cc_hash_table &other)β swaps withother.
π« Detailed Description π«
Okay so the class template is giving "I have a lot of defaults and I'm not sorry":
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
class __gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn, Eq_Fn,
Comb_Hash_Fn, Resize_Policy, Store_Hash, _Alloc >
A collision-chaining hash-based associative container. Periodt. π
π§ Template Parameters π§
Keyβ Key type.Mappedβ Map type.Hash_Fnβ Hashing functor.Eq_Fnβ Equal functor.Comb_Hash_Fnβ Combining hash functor. IfHash_Fnis notnull_type, then this is the ranged-hash functor; otherwise, this is the range-hashing functor. XXX(SeeDesign::Hash-Based Containers::Hash Policies.)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.
Base tag choices are: cc_hash_tag.
Base is basic_hash_table.
π οΈ Constructor & Destructor Documentation
Okay bestie, this is the part where we actually build the thing π
Nine constructors, all of them [inline], and literally every single one of them starts with the exact same giant template header. So here's that header, in full, one time as a reference β then every constructor below keeps it verbatim, because we do not skip details in this house π«Ά
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
cc_hash_table() β the default one β¨
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
__gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Hash_Fn,
Resize_Policy, Store_Hash, _Alloc >::cc_hash_table () [inline]
Default constructor. That's it, that's the whole vibe β no arguments, no fuss, just a fresh little container ready to be filled π
cc_hash_table(const hash_fn & h) β one policy, please πΈ
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
__gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Hash_Fn,
Resize_Policy, Store_Hash, _Alloc >::cc_hash_table (const hash_fn & h) [inline]
Constructor taking some policy objects. r_hash_fn will be copied by the Hash_Fn object of the container object. (Yes, it takes h and the docs call it r_hash_fn β that's just how it is, iykyk π)
cc_hash_table(const hash_fn & h, const eq_fn & e) β policy duo π¦
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
__gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Hash_Fn,
Resize_Policy, Store_Hash, _Alloc >::cc_hash_table (const hash_fn & h,
const eq_fn & e) [inline]
Constructor taking some policy objects. 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. Two policies, both slotted in, no notes π
cc_hash_table(const hash_fn & h, const eq_fn & e, const comb_hash_fn & ch) β policy trio π
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
__gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Hash_Fn,
Resize_Policy, Store_Hash, _Alloc >::cc_hash_table (const hash_fn & h,
const eq_fn & e, const comb_hash_fn & ch) [inline]
Constructor taking some policy objects. 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_hash_fn will be copied by the comb_hash_fn object of the container object. Look at us, collecting policies like PokΓ©mon β¨
cc_hash_table(const hash_fn & h, const eq_fn & e, const comb_hash_fn & ch, const resize_policy & rp) β the full policy stack π
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
__gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn, Eq_Fn, Comb_Hash_Fn,
Resize_Policy, Store_Hash, _Alloc >::cc_hash_table (const hash_fn & h,
const eq_fn & e, const comb_hash_fn & ch, const resize_policy & rp) [inline]
Constructor taking some policy objects. 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_hash_fn will be copied by the comb_hash_fn object of the container object, and r_resize_policy will be copied by the resize_policy object of the container object. All four, all copied, main character energy fr fr π₯
cc_hash_table(It first, It last) β feed it a range π
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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
template<typename It > __gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn,
Eq_Fn, Comb_Hash_Fn, Resize_Policy, Store_Hash, _Alloc >::cc_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. Snack-sized constructor: hand it a range, it eats the range π§
cc_hash_table(It first, It last, const hash_fn & h) β range + hash 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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
template<typename It > __gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn,
Eq_Fn, Comb_Hash_Fn, Resize_Policy, Store_Hash, _Alloc >::cc_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. Range first, policy second, chaos zero π
cc_hash_table(It first, It last, const hash_fn & h, const eq_fn & e) β range + two 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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
template<typename It > __gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn,
Eq_Fn, Comb_Hash_Fn, Resize_Policy, Store_Hash, _Alloc >::cc_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. (Yes, the original sentence really does run straight on into "The value_typesβ¦" with no period β we're keeping it 100% as-is π)
cc_hash_table(It first, It last, const hash_fn & h, const eq_fn & e, const comb_hash_fn & ch) β range + three 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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
template<typename It > __gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn,
Eq_Fn, Comb_Hash_Fn, Resize_Policy, Store_Hash, _Alloc >::cc_hash_table
(It first, It last, const hash_fn & h, const eq_fn & e, const
comb_hash_fn & ch) [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_hash_fn will be copied by the comb_hash_fn object of the container object. We're so back π
cc_hash_table(It first, It last, const hash_fn & h, const eq_fn & e, const comb_hash_fn & ch, const resize_policy & rp) β the everything 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_Hash_Fn =
detail::default_comb_hash_fn::type, typename Resize_Policy = typename
detail::default_resize_policy<Comb_Hash_Fn>::type, bool Store_Hash =
detail::default_store_hash, typename _Alloc = std::allocator<char>>
template<typename It > __gnu_pbds::cc_hash_table< Key, Mapped, Hash_Fn,
Eq_Fn, Comb_Hash_Fn, Resize_Policy, Store_Hash, _Alloc >::cc_hash_table
(It first, It last, const hash_fn & h, const eq_fn & e, const
comb_hash_fn & ch, 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_hash_fn will be copied by the comb_hash_fn object of the container object, and r_resize_policy will be copied by the resize_policy object of the container object. Range plus literally every policy β the final boss of constructors, no cap π₯
πΈ Author πΈ
Generated automatically by Doxygen for libstdc++ from the source code. Not a human, not a group chat, just Doxygen doing its lil thing π€π
And that's a wrap on this page, bestie! π This one came from libstdc++, that adorable automatic Doxygen generation situation, and the footer of the original was the usual libstd__gnu_pbds::cc..._Hash, _Alloc >(3cxx) section marker β so yeah, that's the source, that's the version, that's the date line, all accounted for β¨ Go forth and hash, you icon ππ
π¦ 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