__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 name comb_hash_fn.
  • typedef cc_hash_tag container_category β€” the container category tag, and it's cc_hash_tag.
  • typedef Eq_Fn eq_fn β€” the equality functor type, living as eq_fn.
  • typedef Hash_Fn hash_fn β€” the hashing functor type, aka hash_fn.
  • typedef Resize_Policy resize_policy β€” the resize policy type, serving looks as resize_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 from other.
  • cc_hash_table (const hash_fn &h) β€” constructor taking some policy objects. r_hash_fn will be copied by the Hash_Fn object of the container object.
  • cc_hash_table (const hash_fn &h, const eq_fn &e) β€” 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.
  • cc_hash_table (const hash_fn &h, const eq_fn &e, const comb_hash_fn &ch) β€” 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.
  • 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_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.
  • template<typename It > cc_hash_table (It first, It last) β€” 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.
  • template<typename It > cc_hash_table (It first, It last, const hash_fn &h) β€” 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.
  • template<typename It > cc_hash_table (It first, It last, const hash_fn &h, const eq_fn &e) β€” 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.
  • 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 __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.
  • 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 __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.
  • cc_hash_table & operator= (const cc_hash_table &other) β€” assignment operator from other.
  • void swap (cc_hash_table &other) β€” swaps with other.

πŸ’« 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. If Hash_Fn is not null_type, then this is the ranged-hash functor; otherwise, this is the range-hashing functor. XXX(See Design::Hash-Based Containers::Hash Policies.)
  • Resize_Policy β€” Resizes hash.
  • Store_Hash β€” Indicates whether the hash value will be stored along with each key. If Hash_Fn is null_type, then the container will not compile if this value is true.
  • _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 πŸ‘‘πŸ’