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 typedef
  • typedef _Hashtable::const_pointer const_pointer โ€” iterator-related typedef
  • typedef _Hashtable::reference reference โ€” iterator-related typedef
  • typedef _Hashtable::const_reference const_reference โ€” iterator-related typedef
  • typedef _Hashtable::iterator iterator โ€” iterator-related typedef
  • typedef _Hashtable::const_iterator const_iterator โ€” iterator-related typedef
  • typedef _Hashtable::local_iterator local_iterator โ€” iterator-related typedef
  • typedef _Hashtable::const_local_iterator const_local_iterator โ€” iterator-related typedef
  • typedef _Hashtable::size_type size_type โ€” iterator-related typedef
  • typedef _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 an unordered_multimap with 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 stays
  • unordered_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 whole noexcept(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 iterator
  • local_iterator begin (size_type __n) โ€” returns a read/write iterator pointing to the first bucket element
  • size_type bucket_count () const noexcept โ€” returns the number of buckets of the unordered_multimap
  • size_type bucket_size (size_type __n) const โ€” no description, just a bucket size
  • void clear () noexcept โ€” no description, but you know what it does bestie
  • 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 โ€” the end, literally
  • local_iterator end (size_type __n) โ€” returns a read/write iterator pointing to one past the last bucket elements
  • iterator erase (const_iterator __first, const_iterator __last) โ€” erases a [__first,__last) range of elements from an unordered_multimap
  • 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
  • void insert (initializer_list< value_type > __l) โ€” attempts to insert a list of elements into the unordered_multimap
  • 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
  • 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 (yes, the noexcept(noexcept(...)) is part of it, don't touch it ๐Ÿซถ)

the const-iterator era + the overload club ๐Ÿฆ‹

  • const_iterator begin () const noexcept
  • const_iterator cbegin () const noexcept
  • const_iterator end () const noexcept
  • const_iterator cend () const noexcept

insert overloads, all six, because they said "why not all of them":

  • 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

erase overloads:

  • iterator erase (const_iterator __position) โ€” erases an element from an unordered_multimap
  • iterator erase (iterator __position) โ€” erases an element from an unordered_multimap
  • size_type erase (const key_type &__x) โ€” erases elements according to the provided key
  • template<__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 an unordered_multimap
  • const_iterator find (const key_type &__x) const โ€” tries to locate an element in an unordered_multimap

counting & checking:

  • size_type count (const key_type &__x) const โ€” 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

equal_range, the sequel we all asked for:

  • std::pair< iterator, iterator > equal_range (const key_type &__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

bucket lookups:

  • size_type bucket (const key_type &__key) const
  • template<__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 element
  • const_local_iterator cbegin (size_type __n) const โ€” returns a read-only (constant) iterator pointing to the first bucket element
  • const_local_iterator end (size_type __n) const โ€” returns a read-only (constant) iterator pointing to one past the last bucket elements
  • const_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 to hash<_Key>.
  • _Pred โ€” Predicate function object type, defaults to equal_to<_Key>.
  • _Alloc โ€” Allocator type, defaults to std::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 (see std::piecewise_contruct for 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 (see std::piecewise_contruct for 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 (see std::make_pair for 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 (see std::make_pair for 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 (see std::make_pair for 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 (see std::make_pair for 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 (see std::make_pair for 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 โ€” a std::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 (see std::make_pair for 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