STD::UNORDERED_MULTIMAP(3cxx)
โจ NAME โจ
okay bestie, quick vibe check: this is the (3cxx) manual page for std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >, and the manual name is folded right in here so we can skip the boring header repeat. Itโs a standard container composed of equivalent keys โ possibly multiple of each key value โ that associates values of another type with the keys. no cap, thatโs the whole assignment. ๐
๐ธ SYNOPSIS ๐ธ
#include <unordered_map>
๐ Public Types ๐
okay these typedefs are lowkey the backbone of the whole thing. first up:
using node_type = typename _Hashtable::node_typeโ node type, slay.
Public typedefs. the public typedef squad:
typedef _Hashtable::key_type key_typeโ Public typedefs.typedef _Hashtable::value_type value_typeโ Public typedefs.typedef _Hashtable::mapped_type mapped_typeโ Public typedefs.typedef _Hashtable::hasher hasherโ Public typedefs.typedef _Hashtable::key_equal key_equalโ Public typedefs.typedef _Hashtable::allocator_type allocator_typeโ Public typedefs.
Iterator-related typedefs. different flock, same icon energy:
typedef _Hashtable::pointer pointerโ Iterator-related typedefs.typedef _Hashtable::const_pointer const_pointerโ Iterator-related typedefs.typedef _Hashtable::reference referenceโ Iterator-related typedefs.typedef _Hashtable::const_reference const_referenceโ Iterator-related typedefs.typedef _Hashtable::iterator iteratorโ Iterator-related typedefs.typedef _Hashtable::const_iterator const_iteratorโ Iterator-related typedefs.typedef _Hashtable::local_iterator local_iteratorโ Iterator-related typedefs.typedef _Hashtable::const_local_iterator const_local_iteratorโ Iterator-related typedefs.typedef _Hashtable::size_type size_typeโ Iterator-related typedefs.typedef _Hashtable::difference_type difference_typeโ Iterator-related typedefs.
๐ Public Member Functions ๐
this is the long part, bestie โ Iโm splitting it into little group-chat threads so it doesnโt eat the whole timeline. every signature is here, exactly as the page gives it. ๐ซถ
๐ผ Constructors ๐ผ
unordered_multimap ()=defaultโ Default constructor.template<typename _InputIterator > unordered_multimap (_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type &__a)โ range constructor, signature-only moment.template<typename _InputIterator > unordered_multimap (_InputIterator __first, _InputIterator __last, size_type __n, const hasher &__hf, const allocator_type &__a)โ range constructor, signature-only moment.template<typename _InputIterator > unordered_multimap (_InputIterator __first, _InputIterator __last, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())โ Builds an unordered_multimap from a range.unordered_multimap (const allocator_type &__a)โ Creates an unordered_multimap with no elements.unordered_multimap (const unordered_multimap &)=defaultโ Copy constructor.unordered_multimap (const unordered_multimap &__ummap, const allocator_type &__a)โ signature-only moment.unordered_multimap (initializer_list< value_type > __l, size_type __n, const allocator_type &__a)โ signature-only moment.unordered_multimap (initializer_list< value_type > __l, size_type __n, const hasher &__hf, const allocator_type &__a)โ signature-only moment.unordered_multimap (initializer_list< value_type > __l, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())โ Builds an unordered_multimap from an initializer_list.unordered_multimap (size_type __n, const allocator_type &__a)โ signature-only moment.unordered_multimap (size_type __n, const hasher &__hf, const allocator_type &__a)โ signature-only moment.unordered_multimap (size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())โ Default constructor creates no elements.unordered_multimap (unordered_multimap &&)=defaultโ Move constructor.unordered_multimap (unordered_multimap &&__ummap, const allocator_type &__a) noexcept(noexcept(_Hashtable(std::move(__ummap._M_h), __a)))โ signature-only moment.
โจ Everything Else, In Order โจ
these are the rest of the member functions, bestie, and yes Iโm keeping the order because we are respectful like that:
iterator begin () noexceptโ signature-only moment.local_iterator begin (size_type __n)โ Returns a read/write iterator pointing to the first bucket element.size_type bucket (const key_type &__key) constโ signature-only moment.size_type bucket_count () const noexceptโ Returns the number of buckets of the unordered_multimap.size_type bucket_size (size_type __n) constโ signature-only moment.void clear () noexceptโ signature-only moment.template<typename... _Args> iterator emplace (_Args &&... __args)โ Attempts to build and insert a std::pair into the unordered_multimap.template<typename... _Args> iterator emplace_hint (const_iterator __pos, _Args &&... __args)โ Attempts to build and insert a std::pair into the unordered_multimap.bool empty () const noexceptโ Returns true if the unordered_multimap is empty.iterator end () noexceptโ signature-only moment.local_iterator end (size_type __n)โ Returns a read/write iterator pointing to one past the last bucket elements.size_type erase (const key_type &__x)โ Erases elements according to the provided key.iterator erase (const_iterator __first, const_iterator __last)โ Erases a[__first,__last)range of elements from an unordered_multimap.node_type extract (const key_type &__key)โ Extract a node.node_type extract (const_iterator __pos)โ Extract a node.allocator_type get_allocator () const noexceptโ Returns the allocator object used by the unordered_multimap.hasher hash_function () constโ Returns the hash functor object with which the unordered_multimap was constructed.template<typename _InputIterator > void insert (_InputIterator __first, _InputIterator __last)โ A template function that attempts to insert a range of elements.iterator insert (const_iterator __hint, node_type &&__nh)โ Re-insert an extracted node.void insert (initializer_list< value_type > __l)โ Attempts to insert a list of elements into the unordered_multimap.iterator insert (node_type &&__nh)โ Re-insert an extracted node.key_equal key_eq () constโ Returns the key comparison object with which the unordered_multimap was constructed.float load_factor () const noexceptโ Returns the average number of elements per bucket.size_type max_bucket_count () const noexceptโ Returns the maximum number of buckets of the unordered_multimap.float max_load_factor () const noexceptโ Returns a positive number that the unordered_multimap tries to keep the load factor less than or equal to.void max_load_factor (float __z)โ Change the unordered_multimap maximum load factor.size_type max_size () const noexceptโ Returns the maximum size of the unordered_multimap.template<typename _H2 , typename _P2 > void merge (unordered_map< _Key, _Tp, _H2, _P2, _Alloc > &&__source)โ merge overload, signature-only moment.template<typename _H2 , typename _P2 > void merge (unordered_map< _Key, _Tp, _H2, _P2, _Alloc > &__source)โ merge overload, signature-only moment.template<typename _H2 , typename _P2 > void merge (unordered_multimap< _Key, _Tp, _H2, _P2, _Alloc > &&__source)โ merge overload, signature-only moment.template<typename _H2 , typename _P2 > void merge (unordered_multimap< _Key, _Tp, _H2, _P2, _Alloc > &__source)โ merge overload, signature-only moment.unordered_multimap & operator= (const unordered_multimap &)=defaultโ Copy assignment operator.unordered_multimap & operator= (initializer_list< value_type > __l)โ Unordered_multimap list assignment operator.unordered_multimap & operator= (unordered_multimap &&)=defaultโ Move assignment operator.void rehash (size_type __n)โ May rehash the unordered_multimap.void reserve (size_type __n)โ Prepare the unordered_multimap for a specified number of elements.size_type size () const noexceptโ Returns the size of the unordered_multimap.void swap (unordered_multimap &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))โ Swaps data with another unordered_multimap.
๐ซถ The Extra Indented Squad ๐ซถ
these came indented on the page, so here they are in their own little thread:
const_iterator begin () const noexceptโ signature-only moment.const_iterator cbegin () const noexceptโ signature-only moment.const_iterator end () const noexceptโ signature-only moment.const_iterator cend () const noexceptโ signature-only moment.iterator insert (const value_type &__x)โ Inserts a std::pair into the unordered_multimap.iterator insert (value_type &&__x)โ Inserts a std::pair into the unordered_multimap.template<typename _Pair > __enable_if_t< is_constructible< value_type, _Pair && >::value, iterator > insert (_Pair &&__x)โ Inserts a std::pair into the unordered_multimap.iterator insert (const_iterator __hint, const value_type &__x)โ Inserts a std::pair into the unordered_multimap.iterator insert (const_iterator __hint, value_type &&__x)โ Inserts a std::pair into the unordered_multimap.template<typename _Pair > __enable_if_t< is_constructible< value_type, _Pair && >::value, iterator > insert (const_iterator __hint, _Pair &&__x)โ Inserts a std::pair into the unordered_multimap.iterator erase (const_iterator __position)โ Erases an element from an unordered_multimap.iterator erase (iterator __position)โ Erases an element from an unordered_multimap.iterator find (const key_type &__x)โ Tries to locate an element in an unordered_multimap.template<typename _Kt > auto find (const _Kt &__x) -> decltype(_M_h._M_find_tr(__x))โ Tries to locate an element in an unordered_multimap.const_iterator find (const key_type &__x) constโ Tries to locate an element in an unordered_multimap.template<typename _Kt > auto find (const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x))โ Tries to locate an element in an unordered_multimap.size_type count (const key_type &__x) constโ Finds the number of elements.template<typename _Kt > auto count (const _Kt &__x) const -> decltype(_M_h._M_count_tr(__x))โ Finds the number of elements.bool contains (const key_type &__x) constโ Finds whether an element with the given key exists.template<typename _Kt > auto contains (const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x), void(), true)โ Finds whether an element with the given key exists.std::pair< iterator, iterator > equal_range (const key_type &__x)โ Finds a subsequence matching given key.template<typename _Kt > auto equal_range (const _Kt &__x) -> decltype(_M_h._M_equal_range_tr(__x))โ Finds a subsequence matching given key.std::pair< const_iterator, const_iterator > equal_range (const key_type &__x) constโ Finds a subsequence matching given key.template<typename _Kt > auto equal_range (const _Kt &__x) const -> decltype(_M_h._M_equal_range_tr(__x))โ Finds a subsequence matching given key.const_local_iterator begin(size_type __n) constโ gives you a read-only (constant) iterator pointing at the first element in that bucket. ๐ชฃconst_local_iterator cbegin(size_type __n) constโ same energy, same deal: a read-only (constant) iterator pointing at the first element of the bucket. โจconst_local_iterator end(size_type __n) constโ read-only (constant) iterator pointing at one past the last element of that bucket. classic off-the-end behavior, no cap. ๐ซถconst_local_iterator cend(size_type __n) constโ and here's thectwin: read-only (constant) iterator pointing one past the last bucket elements. ๐ซ
๐ซ Friends
okay so this container is friends with these two, they get the keys to the group chat ๐
- ```cpp template<typename _Key1, typename _Tp1, typename _Hash1, typename _Pred1, typename _Alloc1> bool operator==(const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&, const unordered_multimap<_Key1, _Tp1, _Hash1, _Pred1, _Alloc1>&)
- ```cpp
template<typename, typename, typename> class std::_Hash_merge_helper
๐ Detailed Description
okay bestie, here's the whole entire vibe of the class. it lives in this template:
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>>
class std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>
and what it is: "A standard container composed of equivalent keys (possibly containing multiple of each key value) that associates values of another type with the keys." no cap, that's the whole personality ๐
Since: C++11 โณ
๐ Template Parameters
_Keyโ type of key objects. ๐_Tpโ type of mapped objects. ๐บ๏ธ_Hashโ hashing function object type, defaults tohash<_Value>. ๐_Predโ predicate function object type, defaults toequal_to<_Value>. โ๏ธ_Allocโ allocator type, defaults tostd::allocator<std::pair<const _Key, _Tp>>. ๐งบ
it Meets the requirements of a container, and unordered associative container โ it's giving qualified icon behavior ๐
the resulting value type of the container is std::pair<const _Key, _Tp>. periodt.
base is _Hashtable, dispatched at compile time via template alias __ummap_hashtable. iykyk ๐ง
๐ธ Member Typedef Documentation
everything below is nested in this template, so like, imagine this line wrapped around each one of them:
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>>
๐ Public typedefs
allocator_typeโtypedef _Hashtable::allocator_type std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::allocator_type๐งบhasherโtypedef _Hashtable::hasher std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hasher๐key_equalโtypedef _Hashtable::key_equal std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::key_equalโ๏ธkey_typeโtypedef _Hashtable::key_type std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type๐mapped_typeโtypedef _Hashtable::mapped_type std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type๐บ๏ธvalue_typeโtypedef _Hashtable::value_type std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::value_type๐
๐ฆ Iterator-related typedefs
const_iteratorโtypedef _Hashtable::const_iterator std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_iterator๐ซถconst_local_iteratorโtypedef _Hashtable::const_local_iterator std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_local_iterator๐ชฃconst_pointerโtypedef _Hashtable::const_pointer std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_pointer๐ฏconst_referenceโtypedef _Hashtable::const_reference std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::const_reference๐difference_typeโtypedef _Hashtable::difference_type std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::difference_typeโiteratorโtypedef _Hashtable::iterator std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iteratorโจlocal_iteratorโtypedef _Hashtable::local_iterator std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::local_iterator๐ชฃpointerโtypedef _Hashtable::pointer std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::pointer๐referenceโtypedef _Hashtable::reference std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::reference๐ซดsize_typeโtypedef _Hashtable::size_type std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::size_type๐
๐ง Constructor & Destructor Documentation
bestie there are six whole ways to bring one of these into existence and each one has main character energy. all of them sit inside the same class template:
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>>
โญ the plain one
std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap() [default]
Default constructor. that's it, that's the whole thing. ๐
โญ the one where you say how many buckets
std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) [inline], [explicit]
Default constructor creates no elements. (yes the manpage really says "Default constructor creates no elements" here, we are not making the rules, we're just relaying them ๐)
Parameters
__nโ Mnimal initial number of buckets. (their typo, not mine, i'm leaving it exactly as it is ๐)__hfโ a hash functor.__eqlโ a key equality functor.__aโ an allocator object.
โญ the range one
template<typename _InputIterator> std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) [inline]
Builds an unordered_multimap from a range. ๐
Parameters
__firstโ an input iterator.__lastโ an input iterator.__nโ minimal initial number of buckets.__hfโ a hash functor.__eqlโ a key equality functor.__aโ an allocator object.
Create an unordered_multimap consisting of copies of the elements from [__first,__last). this is linear in N (where N is distance(__first,__last)). so like, don't be surprised when it takes a sec on a big range, ok? โณ
โญ the copy one
std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&) [default]
Copy constructor. twin behavior ๐ซถ๐ซถ
โญ the move one
std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&&) [default]
Move constructor. it's leaving the old one on read, iconic ๐
โญ the allocator-only one
std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(const allocator_type& __a) [inline], [explicit]
Creates an unordered_multimap with no elements. empty. blank. a fresh start. ๐
Parameters
__aโ an allocator object.
โญ the initializer_list one
std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(initializer_list<value_type> __l, size_type __n = 0, const hasher& __hf = hasher(), const key_equal& __eql = key_equal(), const allocator_type& __a = allocator_type()) [inline]
Builds an unordered_multimap from an initializer_list. the curly-brace brat era ๐
Parameters
__lโ aninitializer_list.__nโ minimal initial number of buckets.__hfโ a hash functor.__eqlโ a key equality functor.__aโ an allocator object.
Create an unordered_multimap consisting of copies of the elements in the list. this is linear in N (where N is __l.size()). slay, math. ๐ฅ
โจ Member Function Documentation
๐ฆ begin (const)
const_iterator std::unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::begin() const [inline], [noexcept]
Returns a read-only (constant) iterator that points to the first element in the unordered_multimap. it's noexcept, it's inline, it's literally the opening number of the whole container ๐ญ๐
begin() ๐ธ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::begin ()
[inline], [noexcept]
okay so this one hands you a read/write iterator that points at the first element in the unordered_multimap. that's it, that's the whole vibe. first element. go get 'em bestie ๐
begin(size_type __n) โ the bucket one ๐ชฃ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> local_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::begin
(size_type __n) [inline]
gives you a read/write iterator pointing at the first bucket element. yes, buckets have their own little iterators, they're like the local friend group of iterators, iykyk โจ
- Parameters
__nโ the bucket index ๐
- Returns
- a read/write <italics>local</italics> iterator ๐ซถ
begin(size_type __n) const โ const bucket era ๐ฆ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_local_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::begin
(size_type __n) const [inline]
same bucket energy but make it read-only โ a read-only (constant) iterator pointing at the first bucket element. no writing, only looking. like window shopping ๐ญ
- Parameters
__nโ the bucket index ๐
- Returns
- a read-only <italics>local</italics> iterator ๐
bucket_count() ๐ชฃโจ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> size_type
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::bucket_count ()
const [inline], [noexcept]
returns the number of buckets in the unordered_multimap. that's literally it. how many buckets. slay ๐
cbegin() ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::cbegin ()
const [inline], [noexcept]
the const version of begin() โ returns a read-only (constant) iterator pointing at the first element in the unordered_multimap. the "c" stands for can't touch this ๐
โจ
cbegin(size_type __n) ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_local_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::cbegin
(size_type __n) const [inline]
read-only local iterator pointing at the first bucket element. bucket but const. iconic behavior honestly ๐ง
- Parameters
__nโ the bucket index ๐
- Returns
- a read-only <italics>local</italics> iterator ๐
cend() ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::cend ()
const [inline], [noexcept]
returns a read-only (constant) iterator pointing one past the last element in the unordered_multimap. the classic past-the-end spot, no elements live there, it's purely a landmark ๐บ๏ธ
Referenced by std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert() ๐
cend(size_type __n) ๐ซง
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_local_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::cend
(size_type __n) const [inline]
read-only (constant) iterator pointing to one past the last bucket elements. yep, plural "elements" โ that's exactly how the original says it, no cap ๐ซถ
- Parameters
__nโ the bucket index ๐
- Returns
- a read-only <italics>local</italics> iterator ๐
clear() ๐๐งน
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> void
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::clear ()
[inline], [noexcept]
erases all elements in an unordered_multimap. poof, gone, that's the tweet ๐ฅ
โ ๏ธ real talk bestie: this function only erases the elements. if the elements themselves are pointers, the pointed-to memory is not touched in any way. managing the pointer is the user's responsibility. so likeโฆ don't come crying to me when your news leak, okay? ๐ญ๐
contains(const _Kt& __x) โ the templated one ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Kt> auto
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::contains
(const _Kt & __x) const -> decltype(_M_h._M_find_tr(__x), void(), true)
[inline]
finds whether an element with the given key exists. yes/no. does it exist. that's the whole function โจ
- Parameters
__xโ key of elements to be located ๐
- Returns
Trueif there is any element with the specified key ๐
contains(const key_type& __x) ๐ธ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> bool
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::contains
(const key_type & __x) const [inline]
same thing, the non-template twin โ finds whether an element with the given key exists ๐ฆ
- Parameters
__xโ key of elements to be located ๐
- Returns
Trueif there is any element with the specified key ๐
count(const _Kt& __x) โ templated counting ๐ข
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Kt> auto
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::count
(const _Kt & __x) const -> decltype(_M_h._M_count_tr(__x))
[inline]
finds the number of elements. and because this is a <italics>multi</italics>map, that number can absolutely be more than one โ duplicates are kind of the whole point here ๐โจ
- Parameters
__xโ key to count ๐
- Returns
- number of elements with specified key ๐
count(const key_type& __x) ๐ข๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> size_type
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::count
(const key_type & __x) const [inline]
the non-template version โ finds the number of elements ๐ซถ
- Parameters
__xโ key to count ๐
- Returns
- number of elements with specified key ๐
emplace(_Args&&... __args) ๐ ๏ธโจ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename... _Args>
iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc
>::emplace (_Args &&... __args) [inline]
attempts to build and insert a std::pair into the unordered_multimap. like, it constructs it right there in place, no awkward middleman, main character energy ๐
- Parameters
__argsโ arguments used to generate a new pair instance (seestd::piecewise_contructfor passing arguments to each part of the pair constructor) ๐
- Returns
- an iterator that points to the inserted pair ๐ฆ
this function attempts to build and insert a (key, value) pair into the unordered_multimap.
insertion requires amortized constant time โก
emplace_hint(const_iterator __pos, _Args&&... __args) ๐ฏ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename... _Args>
iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc
>::emplace_hint (const_iterator __pos, _Args &&... __args) [inline]
attempts to build and insert a std::pair into the unordered_multimap โ but this time you're allowed to drop a hint ๐ฎโ๐จ
- Parameters
__posโ an iterator that serves as a <italics>hint</italics> as to where the pair should be inserted ๐__argsโ arguments used to generate a new pair instance (seestd::piecewise_contructfor passing arguments to each part of the pair constructor) ๐
- Returns
- an iterator that points to the element with key of the
std::pairbuilt from__args๐
- an iterator that points to the element with key of the
note: the first parameter is only a hint and can potentially improve the performance of the insertion process. a bad hint would cause no gains in efficiency โ so it's giving "helpful suggestion," not "command" ๐
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting ๐ง
insertion requires amortized constant time โก
empty() ๐ซ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> bool
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::empty ()
const [inline], [noexcept]
returns true if the unordered_multimap is empty. that's it. vibe check: is it void? ๐
end() const ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::end ()
const [inline], [noexcept]
returns a read-only (constant) iterator pointing one past the last element in the unordered_multimap ๐
end() ๐๐ซ
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::end ()
[inline], [noexcept]
returns a read/write iterator pointing one past the last element in the unordered_multimap ๐ซถ
Referenced by std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::extract() ๐
end(size_type __n) ๐ชฃ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> local_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::end
(size_type __n) [inline]
returns a read/write iterator pointing to one past the last bucket elements ๐
- Parameters
__nโ the bucket index ๐
- Returns
- a read/write <italics>local</italics> iterator ๐
end(size_type __n) const ๐ชฃ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_local_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::end
(size_type __n) const [inline]
returns a read-only (constant) iterator pointing to one past the last bucket elements ๐ง
- Parameters
__nโ the bucket index ๐
- Returns
- a read-only <italics>local</italics> iterator ๐
equal_range(const _Kt& __x) โ non-const ๐ธ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Kt> auto
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::equal_range
(const _Kt & __x) -> decltype(_M_h._M_equal_range_tr(__x))
[inline]
finds a subsequence matching given key ๐ฆ
- Parameters
__xโ key to be located ๐
- Returns
- pair of iterators that <italics>possibly</italics> points to the subsequence matching given key ๐
equal_range(const _Kt& __x) const โ const twin ๐ฆ๐
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Kt> auto
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::equal_range
(const _Kt & __x) const -> decltype(_M_h._M_equal_range_tr(__x))
[inline]
same find-a-subsequence-matching-given-key behavior, just const'd ๐
- Parameters
__xโ key to be located ๐
- Returns
- pair of iterators that <italics>possibly</italics> points to the subsequence matching given key ๐
๐
equal_range โ the mutable one
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> std::pair< iterator, iterator >
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::equal_range
(const key_type & __x) [inline]
Bestie, this one hunts down the whole subsequence that matches the key you hand it. Yes, a subsequence โ because this is a multimap, remember? Multiple entries per key is literally the whole point ๐
- Parameters
__xโ the key you're looking for.
- Returns
- a pair of iterators that possibly points to the subsequence matching the given key.
It's giving "range, but make it a pair." Obsessed. ๐
๐ฆ equal_range โ the const twin
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> std::pair< const_iterator,
const_iterator > std::unordered_multimap< _Key, _Tp, _Hash, _Pred,
_Alloc >::equal_range (const key_type & __x) const [inline]
Same exact energy as above, just const-correct so nobody gets any ideas about mutating through your iterators โจ
- Parameters
__xโ key to be located.
- Returns
- pair of iterators that possibly points to the subsequence matching given key.
๐ฅ erase โ by key (the dramatic one)
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> size_type
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::erase (const
key_type & __x) [inline]
Erases elements according to the key you provide. Not one element โ all of them for that key. It's a purge, a clean slate, main character energy ๐
- Parameters
__xโ key of the elements to be erased.
- Returns
- the number of elements erased.
This function erases all the elements located by the given key from an unordered_multimap. Heads up though: this function only erases the element itself, so if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing that pointer? That's on you, bestie. ๐ซถ
๐ธ erase โ by range [__first,__last)
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap<
_Key, _Tp, _Hash, _Pred, _Alloc >::erase (const_iterator __first,
const_iterator __last) [inline]
Erases a [__first,__last) range of elements from an unordered_multimap. Half-open range, iconic behaviour, no notes โจ
- Parameters
__firstโ iterator pointing to the start of the range to be erased.__lastโ iterator pointing to the end of the range to be erased.
- Returns
- the iterator
__last.
- the iterator
This function erases a sequence of elements from an unordered_multimap. Same caveat as always, and it's a big one: this function only erases the elements, so if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility. Don't forget it ๐ญ
๐ erase โ single element, const_iterator flavour
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap<
_Key, _Tp, _Hash, _Pred, _Alloc >::erase (const_iterator __position)
[inline]
Erases an element from an unordered_multimap. Just the one. So surgical. ๐
- Parameters
__positionโ an iterator pointing to the element to be erased.
- Returns
- an iterator pointing to the element immediately following
__positionprior to the element being erased. If no such element exists,end()is returned.
- an iterator pointing to the element immediately following
This function erases an element, pointed to by the given iterator, from an unordered_multimap. And yeah, say it with me: this function only erases the element, and if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility ๐ฅ
๐ erase โ single element, plain iterator flavour
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap<
_Key, _Tp, _Hash, _Pred, _Alloc >::erase (iterator __position) [inline]
Same deal as the one above, just taking a non-const iterator. Twin behaviour, zero surprises.
- Parameters
__positionโ an iterator pointing to the element to be erased.
- Returns
- an iterator pointing to the element immediately following
__positionprior to the element being erased. If no such element exists,end()is returned.
- an iterator pointing to the element immediately following
This function erases an element, pointed to by the given iterator, from an unordered_multimap. Note that this function only erases the element, and that if the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility โญ
๐ง extract โ by key
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> node_type
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::extract
(const key_type & __key) [inline]
Extract a node. That's it, that's the whole description. Short king behaviour ๐
๐ extract โ by iterator position
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> node_type
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::extract
(const_iterator __pos) [inline]
Extract a node. (Same two-word energy, different entry point โจ)
References std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::end().
๐ find โ transparent overload, non-const
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Kt > auto
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::find (const
_Kt & __x) -> decltype(_M_h._M_find_tr(__x))
[inline]"
Tries to locate an element in an unordered_multimap. (Yes, that trailing quote is literally in the docs. We leave artifacts alone. ๐)
- Parameters
__xโ key to be located.
- Returns
- iterator pointing to the sought-after element, or
end()if not found.
- iterator pointing to the sought-after element, or
This function takes a key and tries to locate the element with which the key matches. If successful, the function returns an iterator pointing to the sought-after element. If unsuccessful, it returns the past-the-end (end()) iterator. Lowkey the most-used function in the whole container, ngl ๐
๐ฆ find โ transparent overload, const
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Kt > auto
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::find (const
_Kt & __x) const -> decltype(_M_h._M_find_tr(__x))
[inline]"
Tries to locate an element in an unordered_multimap. Const version, same quest ๐ซถ
- Parameters
__xโ key to be located.
- Returns
- iterator pointing to the sought-after element, or
end()if not found.
- iterator pointing to the sought-after element, or
This function takes a key and tries to locate the element with which the key matches. If successful, the function returns an iterator pointing to the sought-after element. If unsuccessful, it returns the past-the-end (end()) iterator.
๐ฅ find โ plain key_type, non-const
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap<
_Key, _Tp, _Hash, _Pred, _Alloc >::find (const key_type & __x) [inline]
Tries to locate an element in an unordered_multimap.
- Parameters
__xโ key to be located.
- Returns
- iterator pointing to the sought-after element, or
end()if not found.
- iterator pointing to the sought-after element, or
This function takes a key and tries to locate the element with which the key matches. If successful, the function returns an iterator pointing to the sought-after element. If unsuccessful, it returns the past-the-end (end()) iterator.
๐ธ find โ plain key_type, const
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> const_iterator
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::find (const
key_type & __x) const [inline]
Tries to locate an element in an unordered_multimap. Last of the four, we ate ๐
- Parameters
__xโ key to be located.
- Returns
- iterator pointing to the sought-after element, or
end()if not found.
- iterator pointing to the sought-after element, or
This function takes a key and tries to locate the element with which the key matches. If successful, the function returns an iterator pointing to the sought-after element. If unsuccessful, it returns the past-the-end (end()) iterator.
๐ get_allocator
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> allocator_type
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc
>::get_allocator () const [inline], [noexcept]
Returns the allocator object used by the unordered_multimap. Short, sweet, noexcept โ the holy trinity โจ
๐ hash_function
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> hasher std::unordered_multimap<
_Key, _Tp, _Hash, _Pred, _Alloc >::hash_function () const [inline]
Returns the hash functor object with which the unordered_multimap was constructed. Like, the actual hasher it was born with ๐
๐ insert โ range insert
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _InputIterator
> void std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc
>::insert (_InputIterator __first, _InputIterator __last) [inline]
A template function that attempts to insert a range of elements. "Attempts" โ cute, it's trying its best ๐ซถ
- Parameters
__firstโ iterator pointing to the start of the range to be inserted.__lastโ iterator pointing to the end of the range.
- Complexity
- similar to that of the range constructor.
โญ insert โ perfect-forwarded pair
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Pair >
__enable_if_t< is_constructible< value_type, _Pair && >::value, iterator
> std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert
(_Pair && __x) [inline]
Inserts a std::pair into the unordered_multimap. Note the SFINAE gatekeeping โ it only shows up if is_constructible< value_type, _Pair && >::value is true. We love a conditional icon ๐
- Parameters
__xโ pair to be inserted (seestd::make_pairfor easy creation of pairs).
- Returns
- an iterator that points to the inserted pair.
Insertion requires amortized constant time. Fr fr, it's fast ๐ฅ
๐ง insert โ const value_type reference
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap<
_Key, _Tp, _Hash, _Pred, _Alloc >::insert (const value_type & __x)
[inline]
Inserts a std::pair into the unordered_multimap. The classic, the original, the blueprint ๐
- Parameters
__xโ pair to be inserted (seestd::make_pairfor easy creation of pairs).
- Returns
- an iterator that points to the inserted pair.
Insertion requires amortized constant time.
๐ insert โ with a hint
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>,
typename _Pred = equal_to<_Key>, typename _Alloc =
allocator<std::pair<const _Key, _Tp>>> template<typename _Pair >
__enable_if_t< is_constructible< value_type, _Pair && >::value, iterator
> std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert
(const_iterator __hint, _Pair && __x) [inline]
Inserts a std::pair into the unordered_multimap โ and this time you get to pass a __hint const_iterator as a little suggestion of where it might go. That's all the docs say, so that's all we're claiming ๐
Okay so for this hinted insert that was mid-explanation, the params are:
__hintโ an iterator that serves as a hint as to where the pair should be inserted.__xโ pair to be inserted (seestd::make_pairfor easy creation of pairs).
Returns: an iterator that points to the element with key of __x (may or may not be the pair passed in).
Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.
Insertion requires amortized constant time.
Next up, bestie, it's the hinted const value_type & version:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert (const_iterator __hint, const value_type & __x) [inline]
Inserts a std::pair into the unordered_multimap. Obsessed with how direct that is.
__hintโ an iterator that serves as a hint as to where the pair should be inserted.__xโ pair to be inserted (seestd::make_pairfor easy creation of pairs).
Returns: an iterator that points to the element with key of __x (may or may not be the pair passed in).
Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.
Insertion requires amortized constant time. Fr fr, that's the whole vibe.
Then there's the node re-insert with a hint:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert (const_iterator __hint, node_type && __nh) [inline]
Re-insert an extracted node. That's it, that's the whole function. It references std::move(). Slay.
And here's the hinted value_type && flavor:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert (const_iterator __hint, value_type && __x) [inline]
Inserts a std::pair into the unordered_multimap. Same iconic energy as before:
__hintโ an iterator that serves as a hint as to where the pair should be inserted.__xโ pair to be inserted (seestd::make_pairfor easy creation of pairs).
Returns: an iterator that points to the element with key of __x (may or may not be the pair passed in).
Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints for more on hinting.
Insertion requires amortized constant time. Also references std::move(). Periodt.
Next, the initializer-list insert:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> void std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert (initializer_list< value_type > __l) [inline]
Attempts to insert a list of elements into the unordered_multimap. It's giving "bring the whole group chat."
__lโ astd::initializer_list<value_type>of elements to be inserted.
Complexity similar to that of the range constructor. Ngl, that's a cute little detail to keep.
Then the non-hinted extracted-node insert:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert (node_type && __nh) [inline]
Re-insert an extracted node. It references std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::cend(), and std::move(). Lowkey a whole little crossover episode.
And the non-hinted value_type && insert:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::insert (value_type && __x) [inline]
Inserts a std::pair into the unordered_multimap.
__xโ pair to be inserted (seestd::make_pairfor easy creation of pairs).
Returns: an iterator that points to the inserted pair.
Insertion requires amortized constant time. References std::move(). That's the tea. ๐ซถ
Now for the key-comparison check-in:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> key_equal std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::key_eq () const [inline]
Returns the key comparison object with which the unordered_multimap was constructed. Iconic little origin-story moment.
Load factor time:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> float std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::load_factor () const [inline], [noexcept]
Returns the average number of elements per bucket. Math girlie behavior, honestly.
Max bucket count:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> size_type std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::max_bucket_count () const [inline], [noexcept]
Returns the maximum number of buckets of the unordered_multimap. Bucket maximum, no cap. ๐
Max load factor getter:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> float std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::max_load_factor () const [inline], [noexcept]
Returns a positive number that the unordered_multimap tries to keep the load factor less than or equal to. It's giving "boundaries, bestie."
Max load factor setter:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> void std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::max_load_factor (float __z) [inline]
Change the unordered_multimap maximum load factor.
__zโ the new maximum load factor.
That's the whole adjustment. Very main character of it.
Max size:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> size_type std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::max_size () const [inline], [noexcept]
Returns the maximum size of the unordered_multimap. Maximum capacity, literally.
Copy assignment operator, default behavior and all:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> unordered_multimap & std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::operator= (const unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &) [default]
Copy assignment operator. Default. We love a reliable classic. ๐ธ
Initializer-list assignment:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> unordered_multimap & std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::operator= (initializer_list< value_type > __l) [inline]
Unordered_multimap list assignment operator.
__lโ aninitializer_list.
This function fills an unordered_multimap with copies of the elements in the initializer list __l.
Note that the assignment completely changes the unordered_multimap and that the resulting unordered_multimap's size is the same as the number of elements assigned. Not me warning you that it's a full glow-up, not a little touch-up.
Move assignment operator:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> unordered_multimap & std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::operator= (unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &&) [default]
Move assignment operator. Default. Efficient little icon. โจ
Rehash:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> void std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::rehash (size_type __n) [inline]
May rehash the unordered_multimap.
__nโ the new number of buckets.
Rehash will occur only if the new number of buckets respect the unordered_multimap maximum load factor. So it's a "may," not a "will," bestie. Important.
Reserve:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> void std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::reserve (size_type __n) [inline]
Prepare the unordered_multimap for a specified number of elements.
__nโ number of elements required.
Same as rehash(ceil(n / max_load_factor())). That's not me doing math, that's literally the page. ๐
Size:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> size_type std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::size () const [inline], [noexcept]
Returns the size of the unordered_multimap. Short king of a description, honestly.
Swap:
template<typename _Key , typename _Tp , typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> void std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::swap (unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > & __x) [inline], [noexcept]
Swaps data with another unordered_multimap.
__xโ an unordered_multimap of the same element and allocator types.
This exchanges the elements between two unordered_multimap in constant time. Note that the global std::swap() function is specialized such that std::swap(m1,m2) will feed to this function. Cute little handoff, iykyk. ๐ฆ
๐ AUTHOR ๐
Generated automatically by Doxygen for libstdc++ from the source code. No cap, the robots handled the paperwork. ๐ค๐
And that's the tea: the footer's source/version and date marker is libststd::unordered_..._Pred, _Alloc >(3cxx) โ official stamp, iconic energy, slay your containers bestie. ๐
๐
๐ฆ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms