STD::UNORDERED_MULTIMAP(3)
๐ std::unordered_multimap ๐
okay bestie, sit down, hydrate, because this is the whole manual page for std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > from the Library Functions Manual and it is long. It comes in 5 parts, so don't panic when you hit the bottom โ we're just getting started. ๐ธ
๐ NAME ๐
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > โ a standard container composed of equivalent keys (possibly containing multiple of each key value) that associates values of another type with the keys. it's giving "a map but the keys are allowed to be messy and duplicated" and honestly? iconic. ๐
โจ SYNOPSIS โจ
#include <unordered_map>
๐ธ Public Types ๐ธ
the "who even am I" era. first up, the plain public typedefs:
typedef _Hashtable::key_type key_typeโ public typedef ๐typedef _Hashtable::value_type value_typeโ public typedef ๐typedef _Hashtable::mapped_type mapped_typeโ public typedef ๐typedef _Hashtable::hasher hasherโ public typedef ๐typedef _Hashtable::key_equal key_equalโ public typedef ๐typedef _Hashtable::allocator_type allocator_typeโ public typedef ๐
and now the backstage crew, the iterator-related typedefs ๐:
typedef _Hashtable::pointer pointerโ iterator-related typedeftypedef _Hashtable::const_pointer const_pointerโ iterator-related typedeftypedef _Hashtable::reference referenceโ iterator-related typedeftypedef _Hashtable::const_reference const_referenceโ iterator-related typedeftypedef _Hashtable::iterator iteratorโ iterator-related typedeftypedef _Hashtable::const_iterator const_iteratorโ iterator-related typedeftypedef _Hashtable::local_iterator local_iteratorโ iterator-related typedeftypedef _Hashtable::const_local_iterator const_local_iteratorโ iterator-related typedeftypedef _Hashtable::size_type size_typeโ iterator-related typedeftypedef _Hashtable::difference_type difference_typeโ iterator-related typedef
๐ซถ Public Member Functions ๐ซถ
the constructors (aka the origin story)
unordered_multimap () = defaultโ default constructor. no elements, no notes, just vibes โจ
the range squad builds an unordered_multimap from a range โ four of them, all here, all accounted for:
template<typename _InputIterator> unordered_multimap (_InputIterator __first, _InputIterator __last, const allocator_type &__a)
template<typename _InputIterator> unordered_multimap (_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type &__a)
template<typename _InputIterator> unordered_multimap (_InputIterator __first, _InputIterator __last, size_type __n, const hasher &__hf, const allocator_type &__a)
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())
๐ฆ all four of these build an unordered_multimap from a range.
unordered_multimap (const allocator_type &__a)โ creates anunordered_multimapwith no elements. empty. a clean slate. we love a fresh start.unordered_multimap (const unordered_multimap &) = defaultโ copy constructor ๐ซถunordered_multimap (const unordered_multimap &__ummap, const allocator_type &__a)โ copy it, but with your own allocator ๐
the initializer_list girlies, building an unordered_multimap from an initializer_list:
unordered_multimap (initializer_list< value_type > __l, const allocator_type &__a)
unordered_multimap (initializer_list< value_type > __l, size_type __n, const allocator_type &__a)
unordered_multimap (initializer_list< value_type > __l, size_type __n, const hasher &__hf, const allocator_type &__a)
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())
โจ these build an unordered_multimap from an initializer_list.
and the size-based trio โ heads up, the last one is literally labelled default constructor creates no elements in the original, no cap:
unordered_multimap (size_type __n, const allocator_type &__a)
unordered_multimap (size_type __n, const hasher &__hf, const allocator_type &__a)
unordered_multimap (size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type())
๐ yes, it says default constructor creates no elements โ that's the official description, I'm not making it up.
unordered_multimap (unordered_multimap &&) = defaultโ move constructor ๐ฅ everything moves, nothing staysunordered_multimap (unordered_multimap &&__ummap, const allocator_type &__a) noexcept(noexcept(_Hashtable(std::move(__ummap._M_h), __a)))โ move constructor with an allocator, and yes that wholenoexcept(noexcept(...))is the real signature, keep it ๐
the rest of the member functions, in order, all of them ๐
iterator begin () noexceptโ no description given, it's just here being an iteratorlocal_iterator begin (size_type __n)โ returns a read/write iterator pointing to the first bucket elementsize_type bucket_count () const noexceptโ returns the number of buckets of theunordered_multimapsize_type bucket_size (size_type __n) constโ no description, just a bucket sizevoid clear () noexceptโ no description, but you know what it does bestietemplate<typename... _Args> iterator emplace (_Args &&... __args)โ attempts to build and insert astd::pairinto theunordered_multimaptemplate<typename... _Args> iterator emplace_hint (const_iterator __pos, _Args &&... __args)โ attempts to build and insert astd::pairinto theunordered_multimapbool empty () const noexceptโ returnstrueif theunordered_multimapis emptyiterator end () noexceptโ the end, literallylocal_iterator end (size_type __n)โ returns a read/write iterator pointing to one past the last bucket elementsiterator erase (const_iterator __first, const_iterator __last)โ erases a[__first,__last)range of elements from anunordered_multimapallocator_type get_allocator () const noexceptโ returns the allocator object used by theunordered_multimaphasher hash_function () constโ returns the hash functor object with which theunordered_multimapwas constructedtemplate<typename _InputIterator> void insert (_InputIterator __first, _InputIterator __last)โ a template function that attempts to insert a range of elementsvoid insert (initializer_list< value_type > __l)โ attempts to insert a list of elements into theunordered_multimapkey_equal key_eq () constโ returns the key comparison object with which theunordered_multimapwas constructedfloat load_factor () const noexceptโ returns the average number of elements per bucketsize_type max_bucket_count () const noexceptโ returns the maximum number of buckets of theunordered_multimapfloat max_load_factor () const noexceptโ returns a positive number that theunordered_multimaptries to keep the load factor less than or equal tovoid max_load_factor (float __z)โ change theunordered_multimapmaximum load factorsize_type max_size () const noexceptโ returns the maximum size of theunordered_multimapunordered_multimap & operator= (const unordered_multimap &) = defaultโ copy assignment operator ๐unordered_multimap & operator= (initializer_list< value_type > __l)โunordered_multimaplist assignment operator โจunordered_multimap & operator= (unordered_multimap &&) = defaultโ move assignment operator ๐ฅvoid rehash (size_type __n)โ may rehash theunordered_multimapvoid reserve (size_type __n)โ prepare theunordered_multimapfor a specified number of elementssize_type size () const noexceptโ returns the size of theunordered_multimapvoid swap (unordered_multimap &__x) noexcept(noexcept(_M_h.swap(__x._M_h)))โ swaps data with anotherunordered_multimap(yes, thenoexcept(noexcept(...))is part of it, don't touch it ๐ซถ)
the const-iterator era + the overload club ๐ฆ
const_iterator begin () const noexceptconst_iterator cbegin () const noexceptconst_iterator end () const noexceptconst_iterator cend () const noexcept
insert overloads, all six, because they said "why not all of them":
iterator insert (const value_type &__x)โ inserts astd::pairinto theunordered_multimapiterator insert (value_type &&__x)โ inserts astd::pairinto theunordered_multimaptemplate<typename _Pair> __enable_if_t< is_constructible< value_type, _Pair && >::value, iterator > insert (_Pair &&__x)โ inserts astd::pairinto theunordered_multimapiterator insert (const_iterator __hint, const value_type &__x)โ inserts astd::pairinto theunordered_multimapiterator insert (const_iterator __hint, value_type &&__x)โ inserts astd::pairinto theunordered_multimaptemplate<typename _Pair> __enable_if_t< is_constructible< value_type, _Pair && >::value, iterator > insert (const_iterator __hint, _Pair &&__x)โ inserts astd::pairinto theunordered_multimap
erase overloads:
iterator erase (const_iterator __position)โ erases an element from anunordered_multimapiterator erase (iterator __position)โ erases an element from anunordered_multimapsize_type erase (const key_type &__x)โ erases elements according to the provided keytemplate<__heterogeneous_hash_key< unordered_multimap > _Kt> size_type erase (_Kt &&__x)โ erases elements according to the provided key
find overloads:
iterator find (const key_type &__x)โ tries to locate an element in anunordered_multimapconst_iterator find (const key_type &__x) constโ tries to locate an element in anunordered_multimap
counting & checking:
size_type count (const key_type &__x) constโ finds the number of elementsbool contains (const key_type &__x) constโ finds whether an element with the given key existstemplate<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
equal_range, the sequel we all asked for:
std::pair< iterator, iterator > equal_range (const key_type &__x)โ finds a subsequence matching given keystd::pair< const_iterator, const_iterator > equal_range (const key_type &__x) constโ finds a subsequence matching given key
bucket lookups:
size_type bucket (const key_type &__key) consttemplate<__heterogeneous_hash_key< unordered_multimap > _Kt> size_type bucket (const _Kt &__key) const
the const local iterator crew, bucket edition:
const_local_iterator begin (size_type __n) constโ returns a read-only (constant) iterator pointing to the first bucket elementconst_local_iterator cbegin (size_type __n) constโ returns a read-only (constant) iterator pointing to the first bucket elementconst_local_iterator end (size_type __n) constโ returns a read-only (constant) iterator pointing to one past the last bucket elementsconst_local_iterator cend (size_type __n) constโ returns a read-only (constant) iterator pointing to one past the last bucket elements
๐ Friends ๐
just the one bestie, and it's an equality check that takes both sides of the friendship:
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 > &)
that's the whole SYNOPSIS, every last typedef and overload, nothing skipped ๐ and there is still so much more of this page to get through, so stay with me โ
๐ธ DETAILED DESCRIPTION ๐ธ
okay bestie, gather round, because this one is the moment ๐
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 >
It's literally "A standard container composed of equivalent keys (possibly containing multiple of each key value) that associates values of another type with the keys." ๐
Translation for the group chat: same key can show up more than once (that's the multi part, she's not like her mono sister), and every key drags a whole other value along with it. Unordered, so no cute sorted order โ it's giving hash table energy, not std::map energy ๐ฆ
Since: C++11 โจ
๐ง Template Parameters
_Keyโ Type of key objects._Tpโ Type of mapped objects._Hashโ Hashing function object type, defaults tohash<_Key>._Predโ Predicate function object type, defaults toequal_to<_Key>._Allocโ Allocator type, defaults tostd::allocator<std::pair<const _Key, _Tp>>.
She Meets the requirements of a container, and unordered associative container ๐
The resulting value type of the container is std::pair<const _Key, _Tp> ๐ธ
Base is _Hashtable, dispatched at compile time via template alias __ummap_hashtable. iykyk ๐ง
โจ MEMBER TYPEDEF DOCUMENTATION โจ
Every single one of these lives on std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >, and no bestie, we are not skipping any of them. All 16. Periodt ๐
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::allocator_typeโtypedef _Hashtable::allocator_type. Public typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::const_iteratorโtypedef _Hashtable::const_iterator. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::const_local_iteratorโtypedef _Hashtable::const_local_iterator. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::const_pointerโtypedef _Hashtable::const_pointer. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::const_referenceโtypedef _Hashtable::const_reference. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::difference_typeโtypedef _Hashtable::difference_type. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::hasherโtypedef _Hashtable::hasher. Public typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::iteratorโtypedef _Hashtable::iterator. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::key_equalโtypedef _Hashtable::key_equal. Public typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::key_typeโtypedef _Hashtable::key_type. Public typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::local_iteratorโtypedef _Hashtable::local_iterator. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::mapped_typeโtypedef _Hashtable::mapped_type. Public typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::pointerโtypedef _Hashtable::pointer. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::referenceโtypedef _Hashtable::reference. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::size_typeโtypedef _Hashtable::size_type. Iterator-related typedefs.std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::value_typeโtypedef _Hashtable::value_type. Public typedefs.
๐ CONSTRUCTOR & DESTRUCTOR DOCUMENTATION ๐
The glow-up era. Eight ways to bring her into existence ๐ผโจ
๐ซ unordered_multimap () โ default
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::unordered_multimap () [default]
Default constructor. No thoughts, no elements, just vibes ๐ซง
๐ซ unordered_multimap (size_type __n, const hasher & __hf = hasher(), const key_equal & __eql = key_equal(), const allocator_type & __a = allocator_type())
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. ๐
Parameters
__nโ Mnimal initial number of buckets. (yes, the manpage said "Mnimal", we don't fix the ancestors, we respect the lore ๐ซถ)__hfโ A hash functor.__eqlโ A key equality functor.__aโ An allocator object.
๐ซ 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())
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. She's eating, and she's eating everything from __first to __last ๐ฅ
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)). Noted, no cap ๐
๐ซ unordered_multimap (const unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &) โ default
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::unordered_multimap (
const unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > & ) [default]
Copy constructor. Twin moment ๐ฏโโ๏ธ
๐ซ unordered_multimap (unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > &&) โ default
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::unordered_multimap (
unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc > && ) [default]
Move constructor. She's leaving that other object's body behind and taking the keys with her ๐
๐ซ unordered_multimap (const allocator_type & __a)
std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::unordered_multimap (
const allocator_type & __a) [inline], [explicit]
Creates an unordered_multimap with no elements. Empty, but make it fashionable โจ
Parameters
__aโ An allocator object.
๐ซ 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())
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. Curly braces are her love language ๐
Parameters
__lโ An initializer_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()). Same energy, different source ๐
๐ MEMBER FUNCTION DOCUMENTATION ๐
๐ const_iterator 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. Look, don't touch ๐
๐ iterator begin ()
iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::begin ()
[inline], [noexcept]
Returns a read/write iterator that points to the first element in the unordered_multimap. Now you can touch. Main character energy ๐
๐ local_iterator begin (size_type __n)
local_iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::begin (
size_type __n) [inline]
Returns a read/write iterator pointing to the first bucket element. Bucket-specific, so she's zooming into one little pocket of the table ๐ชฃโจ
Parameters
__nโ The bucket index.
Returns
A read/write local iterator.
๐ const_local_iterator begin (size_type __n) const
const_local_iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::begin (
size_type __n) const [inline]
Returns a read-only (constant) iterator pointing to the first bucket element. Same bucket, but hands off ๐ซฃ
Parameters
__nโ The bucket index.
Returns
A read-only local 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]
Gives you the number of buckets in the unordered_multimap. That's it, that's the whole job. Bucket census, bestie ๐ชฃโจ
๐ธ 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]
Hands you a read-only (constant) iterator pointing at the first element in the unordered_multimap. No writing, no touching, just looking ๐
๐ฆ cbegin (bucket flavour)
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]
Same energy, but scoped to one bucket โ gives you a read-only (constant) iterator pointing at the first element inside that bucket.
Parameters
__nโ the bucket index ๐๏ธ
Returns
A read-only local 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]
The classic past-the-end move: a read-only (constant) iterator pointing one past the last element in the unordered_multimap. Standard end-of-range vibes ๐
๐ซง cend (bucket flavour)
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]
Same thing but for a single bucket: a read-only (constant) iterator pointing one past the last bucket elements.
Parameters
__nโ the bucket index ๐๏ธ
Returns
A read-only local 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]
Wipes all elements in the unordered_multimap. Poof, gone, bye ๐
โ ๏ธ But listen โ this only erases the elements themselves. If your elements are pointers, the memory they point at is NOT touched in any way. Managing that pointer? That's on you, bestie. That's the user's responsibility, fr fr. ๐ฅ
๐ contains (the fancy 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]
Checks whether an element with the given key exists at all. Yes or no, that's the whole question ๐
Parameters
__xโ key of elements to be located
Returns
True if there is any element with the specified key.
๐ contains (the key_type one)
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 question, tidier signature: does an element with this key exist?
Parameters
__xโ key of elements to be located
Returns
True if there is any element with the specified key.
๐งฎ 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 >::count (const key_type & __x) const [inline]
Counts how many elements are hanging out under a key. And because this is a multimap, that number can absolutely be more than one ๐ (a regular map could never.)
Parameters
__xโ key to count
Returns
Number of elements with specified key.
๐ ๏ธ emplace
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. Build it in place, no copy-paste drama โจ
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.
So like, the function attempts to build and insert a (key, value) pair into the unordered_multimap.
Insertion requires amortized constant time. Slay โก
๐ช emplace_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... _Args> iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::emplace_hint (const_iterator __pos, _Args &&... __args) [inline]
Same as emplace, but you get to suggest where it should go. Attempts to build and insert a std::pair into the unordered_multimap ๐ฏ
Parameters
__posโ an iterator that serves as a hint 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::pair built from __args.
๐ Real talk: that first parameter is only a hint. It can potentially improve the performance of the insertion process โ but a bad hint would cause no gains in efficiency. No penalty, just no glow-up. ๐
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], [nodiscard], [noexcept]
Returns true if the unordered_multimap is empty. Nothing in there. Void. The vibe check came back empty ๐ณ๏ธ
๐ 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]
A read-only (constant) iterator pointing one past the last element in the unordered_multimap.
๐ end (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 >::end () [inline], [noexcept]
A read/write iterator pointing one past the last element in the unordered_multimap. Full access, no const restrictions, go off ๐
๐ชฃ end (bucket, non-const)
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]
A read/write iterator pointing one past the last bucket elements.
Parameters
__nโ the bucket index ๐๏ธ
Returns
A read/write local iterator.
๐ชฃ end (bucket, 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]
A read-only (constant) iterator pointing one past the last bucket elements.
Parameters
__nโ the bucket index ๐๏ธ
Returns
A read-only local iterator.
๐ฏ equal_range (non-const)
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]
Finds a subsequence matching the given key. Because multimaps can hold multiple matching elements, this is how you grab the whole squad at once ๐ซถ
Parameters
__xโ key to be located
Returns
Pair of iterators that possibly points to the subsequence matching given key.
๐ฏ equal_range (const)
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 deal, read-only edition. Finds a subsequence matching the given key.
Parameters
__xโ key to be located
Returns
Pair of iterators that possibly points to the subsequence matching given key.
โ๏ธ erase (by heterogeneous key)
template<typename _Key, typename _Tp, typename _Hash = hash<_Key>, typename _Pred = equal_to<_Key>, typename _Alloc = allocator<std::pair<const _Key, _Tp>>> template<__heterogeneous_hash_key< unordered_multimap > _Kt> size_type std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::erase (_Kt && __x) [inline]
Erases elements according to the provided key. One call, whole key's worth of elements, gone ๐
Parameters
__xโ key of 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.
โ ๏ธ And again, important: 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 (by key_type)
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 provided key. Same energy, plain key_type signature.
Parameters
__xโ key of 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.
โ ๏ธ Same warning, bestie: only the element gets erased. 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 (range)
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, so __first is in and __last is out โ classic ๐
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.
So like, this is the range version of erase, and it does what it says on the tin: it erases a whole sequence of elements from an unordered_multimap. ๐ซถ
But bestie, listen: this function only erases the elements themselves. If the element is itself a pointer, the memory it points to is not touched in any way. Managing that pointer is your responsibility. Not the container's. Yours. ๐
๐ erase (const_iterator __position)
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. โจ
Parameters
__positionโ an iterator pointing to the element to be erased.
Returns
An iterator pointing to the element immediately following __position prior to the element being erased. If no such element exists, end() is returned. ๐
This function erases an element, pointed to by the given iterator, from an unordered_multimap. And again, for the people in the back: 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 (iterator __position)
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]
Erases an element from an unordered_multimap. Same energy, non-const iterator edition. ๐
Parameters
__positionโ an iterator pointing to the element to be erased.
Returns
An iterator pointing to the element immediately following __position prior to the element being erased. If no such element exists, end() is returned.
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. ๐ฆ
๐ find (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>>> iterator std::unordered_multimap< _Key, _Tp, _Hash, _Pred, _Alloc >::find (const key_type & __x) [inline]
Tries to locate an element in an unordered_multimap. It's giving detective era ๐โจ
Parameters
__xโ key to be located.
Returns
Iterator pointing to sought-after element, or end() if not found.
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. No vibes found? You get end(). Periodt. ๐
๐ find (const key_type & __x) 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 โ but make it const. ๐ง
Parameters
__xโ key to be located.
Returns
Iterator pointing to sought-after element, or end() if not found.
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. Same deal, just a const_iterator this time. ๐ธ
๐ 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. That's it, that's the whole thing. Handing you the allocator like ๐ซดโจ ([noexcept] btw, she doesn't throw, she's chill)
๐งฎ 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 she was built with. ๐
๐ฅ insert (_InputIterator __first, _InputIterator __last)
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. Bulk insert, main character energy. ๐
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 (_Pair && __x)
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. ๐
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. Fast. Slay. โจ
๐ฅ insert (const value_type & __x)
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. ๐
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. Same as before, just with a const value_type &. ๐
๐ช insert (const_iterator __hint, _Pair && __x)
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 โ now with a hint. โจ
Parameters
__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. โญ
๐ช insert (const_iterator __hint, const value_type & __x)
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 โ hint edition, const value_type & flavour. ๐
Parameters
__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. โจ
๐ช insert (const_iterator __hint, value_type && __x)
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 โ hint edition, rvalue value_type && flavour. ๐ฅ
Parameters
__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. ๐
๐ insert (initializer_list< value_type > __l)
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. Yes, curly-brace chaos, but make it legal. ๐
Parameters
__lโ astd::initializer_list<value_type>of elements to be inserted.
Complexity similar to that of the range constructor. ๐ธ
๐ฅ insert (value_type && __x)
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. Move-semantics girlie. ๐ซ
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. โจ
โ๏ธ key_eq
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. The little equality checker she was born with. ๐ซถ
๐ load_factor
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. ๐ That's your density check, bestie โ how packed is she? ([noexcept], she will not be throwing hands.)
๐ธ 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. that's it, that's the whole vibe ๐
๐ max_load_factor (const version) ๐
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. like it's literally manifesting a chill load factor โจ
๐ฆ max_load_factor (setter version) ๐ฆ
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.
Parameters
__zโ The new maximum load factor. so you're basically telling it "bestie, here's your new limit" ๐
โญ 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. it's giving "how big can this baby get" energy ๐
๐ operator= (copy) ๐
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 behavior, no cap, just copying the whole vibe from another unordered_multimap ๐ซถ
๐ operator= (initializer_list) ๐
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. it's the one where you hit it with a lil { ... } list.
Parameters
__lโ An initializer_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. so like, full glow-up, and the size literally matches how many elements you assigned. periodt ๐
๐ operator= (move) ๐
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 behavior, and it's giving "I'll take your stuff and you can keep your empty shell" energy ๐ญโจ
๐ง 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. "may" because it's not always gonna do it, bestie, it's selective ๐
Parameters
__nโ The new number of buckets.
Rehash will occur only if the new number of buckets respect the unordered_multimap maximum load factor. so if __n is not respecting the max load factor, it's literally not happening. no cap.
๐ธ 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. like setting up the space before the party starts ๐
Parameters
__nโ Number of elements required.
Same as rehash(ceil(n / max_load_factor())). so yeah, it's doing the math for you, bestie.
โญ 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. how many elements are in there? that's the tea โ
๐ฆ 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.
Parameters
__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. so like, you can literally just call std::swap(m1,m2) and it'll route here. iconic.
๐ Author ๐
Generated automatically by Doxygen for libstdc++ from the source code. so this whole page? auto-generated, no human wrote it, and it's still serving looks ๐
and that's the whole man page, bestie! served fresh by libstdc++, and the title is literally std::unord..., _Alloc >(3). mwah ๐
๐ฆ 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.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