__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_pointer
  • typedef traits_base::const_reference const_reference
  • typedef _Alloc::difference_type difference_type
  • typedef Eq_Fn eq_fn β€” the equality functor type
  • typedef Hash_Fn hash_fn β€” the hash functor type
  • typedef iterator_ iterator β€” the mutable iterator, slay
  • typedef traits_base::key_const_pointer key_const_pointer
  • typedef traits_base::key_const_reference key_const_reference
  • typedef traits_base::key_pointer key_pointer
  • typedef traits_base::key_reference key_reference
  • typedef traits_base::key_type key_type β€” the key, obviously πŸ’–
  • typedef traits_base::mapped_const_pointer mapped_const_pointer
  • typedef traits_base::mapped_const_reference mapped_const_reference
  • typedef traits_base::mapped_pointer mapped_pointer
  • typedef traits_base::mapped_reference mapped_reference
  • typedef traits_base::mapped_type mapped_type β€” the mapped type, the other half of the ship πŸ₯°
  • typedef __nothrowcopy::indicator no_throw_indicator
  • typedef point_const_iterator_ point_const_iterator
  • typedef point_iterator_ point_iterator
  • typedef traits_base::pointer pointer
  • typedef Probe_Fn probe_fn
  • typedef traits_base::reference reference
  • typedef Resize_Policy resize_policy
  • typedef _Alloc::size_type size_type
  • typedef integral_constant< int, Store_Hash > store_extra
  • typedef stored_data< value_type, size_type, Store_Hash > stored_data_type
  • typedef 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 iconically
  • gp_ht_map (const Hash_Fn &) β€” build one from just a hash functor
  • gp_ht_map (const Hash_Fn &, const Eq_Fn &) β€” hash + equality
  • gp_ht_map (const Hash_Fn &, const Eq_Fn &, const Comb_Probe_Fn &) β€” hash + equality + combining probe
  • gp_ht_map (const Hash_Fn &, const Eq_Fn &, const Comb_Probe_Fn &, const Probe_Fn &) β€” add a probe functor to the mix
  • gp_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 range
  • const_iterator begin () const β€” start of the const iterator range
  • void clear () β€” yeet everything out 🧹
  • template<typename It > void copy_from_range (It, It) β€” copy from an iterator range, literally
  • bool empty () const β€” True if size() == 0.
  • iterator end () β€” end of the mutable iterator range
  • const_iterator end () const β€” end of the const iterator range
  • bool erase (key_const_reference) β€” remove by key
  • template<typename Pred > size_type erase_if (Pred) β€” remove everything matching the predicate, and it tells you how many it got
  • point_iterator find (key_const_reference) β€” find by key, returns a point iterator
  • point_const_iterator find (key_const_reference) const β€” same but const
  • point_iterator find_end () β€” the "not found" sentinel for point iterators
  • point_const_iterator find_end () const β€” const version of said sentinel
  • Comb_Probe_Fn & get_comb_probe_fn () β€” Return current comb_probe_fn.
  • const Comb_Probe_Fn & get_comb_probe_fn () const β€” Return current const comb_probe_fn.
  • Eq_Fn & get_eq_fn () β€” Return current eq_fn.
  • const Eq_Fn & get_eq_fn () const β€” Return current const eq_fn.
  • Hash_Fn & get_hash_fn () β€” Return current hash_fn.
  • const Hash_Fn & get_hash_fn () const β€” Return current const hash_fn.
  • Probe_Fn & get_probe_fn () β€” Return current probe_fn.
  • const Probe_Fn & get_probe_fn () const β€” Return current const probe_fn.
  • Resize_Policy & get_resize_policy () β€” Return current resize_policy.
  • const Resize_Policy & get_resize_policy () const β€” Return current const resize_policy.
  • std::pair< point_iterator, bool > insert (const_reference r_val) β€” insert a value, get back a point iterator plus a success flag
  • size_type max_size () const β€” the absolute max she can hold
  • mapped_reference operator[] (key_const_reference r_key) β€” subscript by key, the classic 🎯
  • size_type size () const β€” how many she's holding rn
  • void 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 receipts
  • store_extra m_store_extra_indicator β€” the store-extra indicator πŸ“

πŸ¦‹ Friends πŸ¦‹

  • class const_iterator_ β€” bestie who gets to read
  • class 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. Default std::equal_to<Key>
  • _Alloc β€” Allocator type.
  • Store_Hash β€” If key type stores extra metadata. Defaults to false.
  • Comb_Probe_Fn β€” Combining probe functor. If Hash_Fn is not null_type, then this is the ranged-probe functor; otherwise, this is the range-hashing functor. XXX See Design::Hash-Based Containers::Hash Policies. Default direct_mask_range_hashing.
  • Probe_Fn β€” Probe functor. Defaults to linear_probe_fn, also quadratic_probe_fn.
  • Resize_Policy β€” Resizes hash. Defaults to hash_standard_resize_policy, using hash_exponential_size_policy and hash_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 if size() == 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 current comb_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 const comb_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 current eq_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 const eq_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 current hash_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 const hash_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 current probe_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 const probe_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 current resize_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 const resize_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 πŸ’–πŸ”₯πŸ‘‘