__GNU_CXX::HASH_MAP(3)

πŸ’– __gnu_cxx::hash_map< _Key, _Tp, _HashFn, _EqualKey, _Alloc > πŸ’–

okay bestie, come sit with me, we're reading a libstdc++ manpage and honestly? it's giving deep lore. this one lives in the Library Functions Manual, it's an __gnu_cxx thing, and yes the title up top got truncated to __gnu_cxx:..., _Alloc >(3) because even the typesetter gave up. we move. 🫢


✨ NAME ✨

__gnu_cxx::hash_map< _Key, _Tp, _HashFn, _EqualKey, _Alloc > β€” that's the whole name, no notes, she's a template and she knows it πŸ’…


🌸 SYNOPSIS 🌸

#include <hash_map>

πŸŽ€ Public Types πŸŽ€

okay so these are all just typedefs that forward straight to the underlying _Ht (except two of them, watch me):

  • typedef _Ht::allocator_type allocator_type
  • typedef _Ht::const_iterator const_iterator
  • typedef _Ht::const_pointer const_pointer
  • typedef _Ht::const_reference const_reference
  • typedef _Tp data_type β€” yep, this one's literally just _Tp, iconic
  • typedef _Ht::difference_type difference_type
  • typedef _Ht::hasher hasher
  • typedef _Ht::iterator iterator
  • typedef _Ht::key_equal key_equal
  • typedef _Ht::key_type key_type
  • typedef _Tp mapped_type β€” also just _Tp, she's matching with data_type, cute
  • typedef _Ht::pointer pointer
  • typedef _Ht::reference reference
  • typedef _Ht::size_type size_type
  • typedef _Ht::value_type value_type

🌈 Public Member Functions 🌈

constructors first, because entrance, obviously:

  • template<class _InputIterator> hash_map (_InputIterator __f, _InputIterator __l)
  • template<class _InputIterator> hash_map (_InputIterator __f, _InputIterator __l, size_type __n)
  • template<class _InputIterator> hash_map (_InputIterator __f, _InputIterator __l, size_type __n, const hasher &__hf)
  • template<class _InputIterator> hash_map (_InputIterator __f, _InputIterator __l, size_type __n, const hasher &__hf, const key_equal &__eql, const allocator_type &__a=allocator_type())
  • hash_map (size_type __n)
  • hash_map (size_type __n, const hasher &__hf)
  • hash_map (size_type __n, const hasher &__hf, const key_equal &__eql, const allocator_type &__a=allocator_type())

and now the whole roster, alphabetized like a good little API:

  • iterator begin ()
  • const_iterator begin () const
  • size_type bucket_count () const
  • void clear ()
  • size_type count (const key_type &__key) const
  • size_type elems_in_bucket (size_type __n) const
  • bool empty () const
  • iterator end ()
  • const_iterator end () const
  • pair< iterator, iterator > equal_range (const key_type &__key)
  • pair< const_iterator, const_iterator > equal_range (const key_type &__key) const
  • size_type erase (const key_type &__key)
  • void erase (iterator __f, iterator __l)
  • void erase (iterator __it)
  • iterator find (const key_type &__key)
  • const_iterator find (const key_type &__key) const
  • allocator_type get_allocator () const
  • hasher hash_funct () const
  • template<class _InputIterator> void insert (_InputIterator __f, _InputIterator __l)
  • pair< iterator, bool > insert (const value_type &__obj)
  • pair< iterator, bool > insert_noresize (const value_type &__obj)
  • key_equal key_eq () const
  • size_type max_bucket_count () const
  • size_type max_size () const
  • _Tp & operator[] (const key_type &__key)
  • void resize (size_type __hint)
  • size_type size () const
  • void swap (hash_map &__hs)

πŸ¦‹ Friends πŸ¦‹

one (1) bestie, and it's the equality operator:

  • template<class _K1, class _T1, class _HF, class _EqK, class _Al> bool operator== (const hash_map< _K1, _T1, _HF, _EqK, _Al > &, const hash_map< _K1, _T1, _HF, _EqK, _Al > &)

πŸ‘‘ Detailed Description πŸ‘‘

here's the actual declaration, in all her main-character glory:

template<class _Key, class _Tp, class _HashFn = hash<_Key>, class _EqualKey
    = equal_to<_Key>, class _Alloc = allocator<_Tp>>
class __gnu_cxx::hash_map< _Key, _Tp, _HashFn, _EqualKey, _Alloc >
This is an SGI extension.

Todo: Needs documentation! See http://gcc.gnu.org/onlinedocs/libstdc++/manual/documentation_style.html

like... the todo literally says it needs documentation 😭 not me reading a manpage that admits it's undocumented. we love transparency tho. 🫢


🧚 Author 🧚

Generated automatically by Doxygen for libstdc++ from the source code.


and that's the whole vibe check, bestie πŸ’œ this page came from libstdc++, dated the manpage footer way, and yes β€” Doxygen wrote it, not a human, so if you see a typo, that's between you and the source code. slay, go hash something, periodt. πŸŽ€βœ¨

πŸ“¦ where this page comes from
  • arch rolling: gcc 16.2.1+r23+gd564253eb6c8-1 Β· GPL-3.0-or-later WITH GCC-exception-3.1 AND GFDL-1.3-or-later
  • fedora 44: libstdc++-docs 16.0.1-0.10.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • fedora 44: libstdc++-docs 16.2.1-2.fc44
  • fedora 44: libstdc++-docs 16.2.1-3.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later AND (GPL-3.0-or-later WITH GCC-exception-3.1) AND (GPL-3.0-or-later WITH Texinfo-exception) AND (LGPL-2.1-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GCC-exception-2.0) AND (GPL-2.0-or-later WITH GNU-compiler-exception) AND BSL-1.0 AND GFDL-1.3-or-later AND Linux-man-pages-copyleft-2-para AND SunPro AND BSD-1-Clause AND BSD-2-Clause AND BSD-2-Clause-Views AND BSD-3-Clause AND BSD-4-Clause AND BSD-Source-Code AND Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 WITH LLVM-Exception) AND ZPL-2.1 AND ISC AND LicenseRef-Fedora-Public-Domain AND HP-1986 AND curl AND Martin-Birgmeier AND HPND-Markus-Kuhn AND dtoa AND SMLNJ AND AMD-newlib AND OAR AND HPND-merchantability-variant AND HPND-Intel
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms