STD::UNORDERED_MULTISET(3cxx)

๐Ÿ’… std::unordered_multiset< _Value, _Hash, _Pred, _Alloc > ๐Ÿ’…

okay so this is the (3cxx) manual page for std::unordered_multiset< _Value, _Hash, _Pred, _Alloc > โ€” yes that's a whole mouthful of template parameters, no we're not scared of it, and yes we're gonna get through all six parts together bestie ๐Ÿซถ


โœจ NAME โœจ

std::unordered_multiset< _Value, _Hash, _Pred, _Alloc > โ€” it's a standard container, and here's the whole vibe: it's made of equivalent keys, meaning it can literally hold multiple copies of each key value (yes, like, a whole little clique of identical keys, iconic behavior honestly ๐ŸŽ€).

And the twist that makes it this container specifically? The elements' keys are the elements themselves. The key isn't chilling off to the side somewhere โ€” the value is the key. main character energy, no cap ๐Ÿ‘‘

โœจ SYNOPSIS โœจ

ok so before literally anything else, you gotta pull the header in or nothing works:

#include <unordered_set>

๐Ÿฆ‹ Public Types ๐Ÿฆ‹

these are the little name tags every type in here wears so you don't have to spell out _Hashtable every five seconds, iykyk ๐Ÿ’…

  • using node_type = typename _Hashtable::node_type โ€” the node-handle type, for all your extract-and-reinsert main character moments ๐Ÿ‘‘

then the plain old public typedefs โ€” every single one, no skipping:

  • typedef _Hashtable::key_type key_type โ€” public typedef ๐Ÿซถ
  • typedef _Hashtable::value_type value_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 iterator-related typedefs, aka the whole squad ๐ŸŽ€:

  • 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 ๐Ÿ’–

constructor szn, let's go ๐Ÿ

  • unordered_multiset() = default โ€” the default constructor, does exactly what it says on the tin โœจ
  • template<typename _InputIterator > unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type &__a) โ€” range constructor, allocator edition
  • template<typename _InputIterator > unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const hasher &__hf, const allocator_type &__a) โ€” range constructor but you also hand it a hasher
  • template<typename _InputIterator > unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type()) โ€” builds an unordered_multiset from a range, with all the defaults pre-loaded, slay ๐Ÿซถ
  • unordered_multiset(const allocator_type &__a) โ€” creates an unordered_multiset with no elements, yes it's empty on purpose, that's the vibe
  • unordered_multiset(const unordered_multiset &) = default โ€” copy constructor, iconic copy-paste energy ๐ŸŽ€
  • unordered_multiset(const unordered_multiset &__umset, const allocator_type &__a) โ€” copy it, but with your own allocator
  • unordered_multiset(initializer_list<value_type> __l, size_type __n, const allocator_type &__a) โ€” initializer_list constructor, allocator edition
  • unordered_multiset(initializer_list<value_type> __l, size_type __n, const hasher &__hf, const allocator_type &__a) โ€” initializer_list plus a hasher plus an allocator
  • unordered_multiset(initializer_list<value_type> __l, size_type __n=0, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type()) โ€” builds an unordered_multiset from an initializer_list, defaults and all ๐Ÿ’œ
  • unordered_multiset(size_type __n, const allocator_type &__a) โ€” bucket-count constructor with allocator
  • unordered_multiset(size_type __n, const hasher &__hf, const allocator_type &__a) โ€” bucket-count constructor with hasher and allocator
  • unordered_multiset(size_type __n, const hasher &__hf=hasher(), const key_equal &__eql=key_equal(), const allocator_type &__a=allocator_type()) โ€” default constructor that creates no elements, like, zero, nada, empty bestie
  • unordered_multiset(unordered_multiset &&) = default โ€” move constructor, zoom zoom ๐Ÿฆ‹
  • unordered_multiset(unordered_multiset &&__umset, const allocator_type &__a) noexcept(noexcept(_Hashtable(std::move(__umset._M_h), __a))) โ€” move constructor with an allocator, and yes that whole noexcept sandwich is part of the deal

then the bucket-y ones ๐Ÿชฃ

  • size_type bucket(const key_type &__key) const โ€” tells you which bucket a key lands in
  • size_type bucket_count() const noexcept โ€” returns the number of buckets of the unordered_multiset
  • size_type bucket_size(size_type __n) const โ€” how big is bucket number __n, bestie

iterators and clearing ๐ŸŒˆ

  • const_iterator cbegin() const noexcept โ€” const iterator to the start
  • const_iterator cend() const noexcept โ€” const iterator to the end
  • void clear() noexcept โ€” wipes it clean ๐Ÿ˜ญ

inserting & friends โœจ

  • template<typename... _Args> iterator emplace(_Args &&... __args) โ€” builds and insert an element into the unordered_multiset, no cap
  • template<typename... _Args> iterator emplace_hint(const_iterator __pos, _Args &&... __args) โ€” inserts an element into the unordered_multiset, with a hint about where
  • bool empty() const noexcept โ€” returns true if the unordered_multiset is empty ๐Ÿซฅ
  • size_type erase(const key_type &__x) โ€” erases elements according to the provided key, bye boo
  • iterator erase(const_iterator __first, const_iterator __last) โ€” erases a [__first,__last) range of elements from an unordered_multiset
  • node_type extract(const key_type &__key) โ€” extract a node ๐Ÿ”‘
  • node_type extract(const_iterator __pos) โ€” extract a node, position edition ๐Ÿ”‘
  • allocator_type get_allocator() const noexcept โ€” returns the allocator object used by the unordered_multiset
  • hasher hash_function() const โ€” returns the hash functor object with which the unordered_multiset was constructed
  • template<typename _InputIterator > void insert(_InputIterator __first, _InputIterator __last) โ€” a template function that inserts a range of elements ๐Ÿ’ซ
  • iterator insert(const_iterator __hint, node_type &&__nh) โ€” re-insert an extracted node, with a hint
  • void insert(initializer_list<value_type> __l) โ€” inserts a list of elements into the unordered_multiset
  • iterator insert(node_type &&__nh) โ€” re-insert an extracted node, no hint needed
  • key_equal key_eq() const โ€” returns the key comparison object with which the unordered_multiset was constructed

load factor & capacity stuff ๐Ÿ”ฅ

  • 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_multiset
  • float max_load_factor() const noexcept โ€” returns a positive number that the unordered_multiset tries to keep the load factor less than or equal to
  • void max_load_factor(float __z) โ€” change the unordered_multiset maximum load factor
  • size_type max_size() const noexcept โ€” returns the maximum size of the unordered_multiset

merge, and yes there's a whole set of them ๐Ÿ‘ฏ

  • template<typename _H2 , typename _P2 > void merge(unordered_multiset< _Value, _H2, _P2, _Alloc > &&__source) โ€” merge from an rvalue unordered_multiset
  • template<typename _H2 , typename _P2 > void merge(unordered_multiset< _Value, _H2, _P2, _Alloc > &__source) โ€” merge from an lvalue unordered_multiset
  • template<typename _H2 , typename _P2 > void merge(unordered_set< _Value, _H2, _P2, _Alloc > &&__source) โ€” merge from an rvalue unordered_set
  • template<typename _H2 , typename _P2 > void merge(unordered_set< _Value, _H2, _P2, _Alloc > &__source) โ€” merge from an lvalue unordered_set

assignment, rehash, reserve, size, swap ๐ŸŽ€

  • unordered_multiset & operator= (const unordered_multiset &)=default โ€” copy assignment operator
  • unordered_multiset & operator= (initializer_list<value_type> __l) โ€” unordered_multiset list assignment operator
  • unordered_multiset & operator= (unordered_multiset &&)=default โ€” move assignment operator, swoosh ๐Ÿฆ‹
  • void rehash(size_type __n) โ€” may rehash the unordered_multiset
  • void reserve(size_type __n) โ€” prepare the unordered_multiset for a specified number of elements
  • size_type size() const noexcept โ€” returns the size of the unordered_multiset
  • void swap(unordered_multiset &__x) noexcept(noexcept(_M_h.swap(__x._M_h))) โ€” swaps data with another unordered_multiset, noexcept incantation included and everything

ok and then there's this whole crew below, still under the member-function umbrella, don't skip 'em ๐Ÿ‘‘

  • iterator begin() noexcept โ€” begin, non-const
  • const_iterator begin() const noexcept โ€” begin, const
  • iterator end() noexcept โ€” end, non-const
  • const_iterator end() const noexcept โ€” end, const ๐ŸŒธ
  • iterator insert(const value_type &__x) โ€” inserts an element into the unordered_multiset
  • iterator insert(value_type &&__x) โ€” inserts an element into the unordered_multiset
  • iterator insert(const_iterator __hint, const value_type &__x) โ€” inserts an element into the unordered_multiset, hint first
  • iterator insert(const_iterator __hint, value_type &&__x) โ€” inserts an element into the unordered_multiset, hint first, rvalue second
  • iterator erase(const_iterator __position) โ€” erases an element from an unordered_multiset
  • iterator erase(iterator __position) โ€” erases an element from an unordered_multiset
  • iterator find(const key_type &__x) โ€” tries to locate an element in an unordered_multiset ๐Ÿ”
  • template<typename _Kt > auto find(const _Kt &__x) -> decltype(_M_h._M_find_tr(__x)) โ€” tries to locate an element in an unordered_multiset, transparently
  • const_iterator find(const key_type &__x) const โ€” tries to locate an element in an unordered_multiset, const
  • template<typename _Kt > auto find(const _Kt &__x) const -> decltype(_M_h._M_find_tr(__x)) โ€” tries to locate an element in an unordered_multiset, const and transparent
  • size_type count(const key_type &__x) const โ€” finds the number of elements ๐Ÿ”ข
  • template<typename _Kt > auto count(const _Kt &__x) const -> decltype(_M_h._M_count_tr(__x)) โ€” finds the number of elements, transparently
  • 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, transparently
  • std::pair< iterator, iterator > equal_range(const key_type &__x) โ€” finds a subsequence matching given key
  • template<typename _Kt > auto equal_range(const _Kt &__x) -> decltype(_M_h._M_equal_range_tr(__x)) โ€” finds a subsequence matching given key, transparently
  • std::pair< const_iterator, const_iterator > equal_range(const key_type &__x) const โ€” finds a subsequence matching given key, const
  • template<typename _Kt > auto equal_range(const _Kt &__x) const -> decltype(_M_h._M_equal_range_tr(__x)) โ€” finds a subsequence matching given key, const and transparent
  • local_iterator begin(size_type __n) โ€” returns a read-only (constant) iterator pointing to the first bucket element ๐Ÿชฃ
  • 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
  • local_iterator end(size_type __n) โ€” returns a read-only (constant) iterator pointing to one past the last bucket elements
  • 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 ๐Ÿซถ

the friends list, literally, and you're on it bestie ๐ŸŽ€

  • template<typename _Value1 , typename _Hash1 , typename _Pred1 , typename _Alloc1 > bool operator==(const unordered_multiset< _Value1, _Hash1, _Pred1, _Alloc1 > &, const unordered_multiset< _Value1, _Hash1, _Pred1, _Alloc1 > &) โ€” the equality comparison, templated to the max
  • template<typename , typename , typename > class std::_Hash_merge_helper โ€” the merge helper, doing the behind-the-scenes work for all those merge overloads ๐Ÿ‘‘

๐Ÿ’– Detailed Description ๐Ÿ’–

okay so picture this: a container that's literally just keys, and the keys are the elements. that's the whole vibe. and bestie โ€” it's a multiset, so it's not gonna gatekeep: equivalent keys can show up more than once. no "sorry, already have that one" energy. it's giving generous. it's giving abundance mindset โœจ

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
class std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >
Since: C++11 โ€” yeah she's a modern girl, she did not exist in the olden times ๐Ÿซถ

๐ŸŒธ Template Parameters ๐ŸŒธ

  • _Value โ€” the type of the key objects. the main character, truly ๐Ÿ‘‘
  • _Hash โ€” the hashing function object type. defaults to hash<_Value>. this is the girl who decides which bucket you end up in ๐Ÿ’…
  • _Pred โ€” the predicate function object type. defaults to equal_to<_Value>. she's the one asking "are you two, like, the same?" ๐ŸŽ€
  • _Alloc โ€” the allocator type. defaults to allocator<_Key>. (yes, the page really does say _Key there and not _Value โ€” we're reporting, not editing ๐Ÿ™ˆ)

๐Ÿฆ‹ Requirements Check ๐Ÿฆ‹

this one meets the requirements of a container, and of an unordered associative container. vibe check: passed, no notes ๐Ÿ‘‘

โญ Under The Hood โญ

base is _Hashtable, dispatched at compile time via the template alias __umset_hashtable. that's it, that's the machinery. iykyk ๐Ÿงš


๐ŸŽ€ Member Typedef Documentation ๐ŸŽ€

so every single one of these is a typedef pulled off _Hashtable, and the template header on top of all of them is always:

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>

now let's go through the whole roster, no skipping, we are thorough in this house ๐Ÿ’…

๐Ÿซถ Public Typedefs ๐Ÿซถ

  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::allocator_type โ€” typedef of _Hashtable::allocator_type
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::hasher โ€” typedef of _Hashtable::hasher
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::key_equal โ€” typedef of _Hashtable::key_equal
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::key_type โ€” typedef of _Hashtable::key_type
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::value_type โ€” typedef of _Hashtable::value_type

okay this group is long, brace yourself bestie ๐Ÿ˜ญ

  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::const_iterator โ€” typedef of _Hashtable::const_iterator
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::const_local_iterator โ€” typedef of _Hashtable::const_local_iterator
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::const_pointer โ€” typedef of _Hashtable::const_pointer
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::const_reference โ€” typedef of _Hashtable::const_reference
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::difference_type โ€” typedef of _Hashtable::difference_type
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::iterator โ€” typedef of _Hashtable::iterator
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::local_iterator โ€” typedef of _Hashtable::local_iterator
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::pointer โ€” typedef of _Hashtable::pointer
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::reference โ€” typedef of _Hashtable::reference
  • std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::size_type โ€” typedef of _Hashtable::size_type

that's 15 typedefs total btw, five public and ten iterator-related. we counted. we do not mess around ๐Ÿ“


โœจ Constructor & Destructor Documentation โœจ

๐ŸŽ€ unordered_multiset() โ€” the default one ๐ŸŽ€

std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::unordered_multiset () [default]

Default constructor. that's the whole description, she's lowkey mysterious, we love that for her ๐Ÿ’…

๐Ÿฆ‹ the bucket-count one ๐Ÿฆ‹

std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::unordered_multiset (size_type __n, const hasher & __hf = hasher(), const key_equal & __eql = key_equal(), const allocator_type & __a = allocator_type()) [inline],  [explicit]

"Default constructor creates no elements." โ€” yes, that's literally what the page says about this one. so: no elements, zero, empty, ghost town on purpose ๐Ÿ‘ป

Parameters:

  • __n โ€” minimal initial number of buckets ๐Ÿชฃ
  • __hf โ€” a hash functor
  • __eql โ€” a key equality functor
  • __a โ€” an allocator object

๐ŸŒˆ the range one ๐ŸŒˆ

template<typename _InputIterator >
std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::unordered_multiset (_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_multiset from a range. love a container that comes pre-loaded ๐Ÿซถ

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_multiset consisting of copies of the elements from [__first,__last). this is linear in N, where N is distance(__first,__last). iconic, efficient, no cap ๐Ÿ”ฅ

๐Ÿ’œ the copy constructor ๐Ÿ’œ

std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::unordered_multiset (const unordered_multiset< _Value, _Hash, _Pred, _Alloc > &) [default]

Copy constructor. twin behaviour, literally identical ๐Ÿ’–

โœจ the move constructor โœจ

std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::unordered_multiset (unordered_multiset< _Value, _Hash, _Pred, _Alloc > &&) [default]

Move constructor. she's not copying, she's relocating. main character energy ๐Ÿ’…

๐Ÿ“ the initializer_list one ๐Ÿ“

std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::unordered_multiset (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_multiset from an initializer_list. the curly-brace girlies are eating today ๐ŸŽ€

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_multiset consisting of copies of the elements in the list. this is linear in N, where N is __l.size(). slay ๐ŸŒธ

๐Ÿ‘‘ the allocator-only one ๐Ÿ‘‘

std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::unordered_multiset (const allocator_type & __a) [inline],  [explicit]

Creates an unordered_multiset with no elements. she's empty but she's custom-allocated empty, and that's a flex ๐Ÿ’…

Parameters:

  • __a โ€” an allocator object

๐Ÿ”ฅ Member Function Documentation ๐Ÿ”ฅ

๐Ÿฆ‹ begin() const โ€” read-only era ๐Ÿฆ‹

const_iterator std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::begin () const [inline],  [noexcept]

Returns a read-only (constant) iterator that points to the first element in the unordered_multiset. โœจ

๐ŸŽ€ begin() โ€” the non-const twin ๐ŸŽ€

iterator std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::begin () [inline],  [noexcept]

Returns a read-only (constant) iterator that points to the first element in the unordered_multiset. and yes bestie, the page says "read-only (constant)" for the non-const overload too โ€” we are quoting, we are not editorializing ๐Ÿ™ˆ

๐ŸŒธ begin(size_type __n) โ€” bucket edition ๐ŸŒธ

local_iterator std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::begin (size_type __n) [inline]

Returns a read-only (constant) iterator pointing to the first bucket element.

Parameters:

  • __n โ€” the bucket index ๐Ÿชฃ

Returns: a read-only local iterator ๐Ÿ’œ

๐Ÿ’– begin(size_type __n) const ๐Ÿ’–

const_local_iterator std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::begin (size_type __n) const [inline]

Returns a read-only (constant) iterator pointing to the first bucket element.

Parameters:

  • __n โ€” the bucket index ๐Ÿชฃ

Returns: a read-only local iterator ๐ŸŒŸ

๐Ÿชฃ bucket_count() ๐Ÿชฃ

size_type std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::bucket_count () const [inline],  [noexcept]

Returns the number of buckets of the unordered_multiset. that's it. count your buckets, know your worth ๐Ÿ‘‘

โญ cbegin() const โญ

const_iterator std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::cbegin () const [inline],  [noexcept]

Returns a read-only (constant) iterator that points to the first element in the unordered_multiset. the "c" stands for const, as always, we been knew ๐Ÿ’…

๐Ÿงš cbegin(size_type __n) const ๐Ÿงš

const_local_iterator std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::cbegin (size_type __n) const [inline]

Returns a read-only (constant) iterator pointing to the first bucket element.

Parameters:

  • __n โ€” the bucket index ๐Ÿชฃ

Returns: a read-only local iterator ๐Ÿ’ซ

cend โ€” const version (whole-container vibe)

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
const_iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::cend () const

[inline], [noexcept] โœจ

Gives you a read-only (constant) iterator that points one past the last element in the unordered_multiset. It's the "you've reached the end, bestie, nothing more to see here" marker ๐Ÿ’…

Fun fact: it's referenced by std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert() โ€” the insert girlies are lowkey relying on it ๐Ÿ‘€


cend โ€” bucket version

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
const_local_iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::cend (size_type __n) const

[inline]

Returns a read-only (constant) iterator pointing to one past the last bucket elements ๐Ÿชฃโœจ

Parameters

  • __n โ€” the bucket index.

Returns

A read-only local iterator.


clear

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
void std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::clear ()

[inline], [noexcept] ๐Ÿงน

Erases all elements in an unordered_multiset. Total clean-slate main character energy โ€” everything gone, no notes ๐Ÿ’€

โš ๏ธ Okay so this is important bestie: this function only erases the elements. If the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility. So likeโ€ฆ don't blame the multiset, she just did what you asked ๐Ÿซถ

contains โ€” the transparent/template one

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
template<typename _Kt>
auto std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::contains (const _Kt &__x) const
    -> decltype(_M_h._M_find_tr(__x), void(), true)

[inline]

Finds whether an element with the given key exists. Yes queen, just a yes-or-no vibe check on your key ๐Ÿ”ฅ

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 _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
bool std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::contains (const key_type &__x) const

[inline]

Same deal, same energy: finds whether an element with the given key exists ๐Ÿ’–

Parameters

  • __x โ€” key of elements to be located.

Returns

true if there is any element with the specified key.


count โ€” the transparent/template one

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
template<typename _Kt>
auto std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::count (const _Kt &__x) const
    -> decltype(_M_h._M_count_tr(__x))

[inline]

Finds the number of elements. Because she's a *multi*set, "how many of these do you have" is a genuinely valid question and the answer can be more than one ๐Ÿ˜Œ๐Ÿ’…

Parameters

  • __x โ€” element to located.

Returns

Number of elements with specified key.


count โ€” the key_type one

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
size_type std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::count (const key_type &__x) const

[inline]

Finds the number of elements. Same as above but takes the plain key_type โœจ

Parameters

  • __x โ€” element to located.

Returns

Number of elements with specified key.


emplace

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
template<typename... _Args>
iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::emplace (_Args &&... __args)

[inline]

Builds and insert an element into the unordered_multiset โ€” she constructs it in place, no little temporary baby needed, iconic behaviour honestly ๐Ÿ‘‘

Parameters

  • __args โ€” arguments used to generate an element.

Returns

An iterator that points to the inserted element.

Insertion requires amortized constant time. โฑ๏ธ Slay.


emplace_hint

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
template<typename... _Args>
iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::emplace_hint (const_iterator __pos, _Args &&... __args)

[inline]

Inserts an element into the unordered_multiset, but you get to hint at where it goes ๐ŸŽ€

Parameters

  • __pos โ€” an iterator that serves as a hint as to where the element should be inserted.
  • __args โ€” arguments used to generate the element to be inserted.

Returns

An iterator that points to the inserted element.

Heads up: the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency. So like, no pressure, but alsoโ€ฆ make it a good hint bestie ๐Ÿ˜ญ

For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints

Insertion requires amortized constant time. โฑ๏ธ


empty

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
bool std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::empty () const

[inline], [noexcept]

Returns true if the unordered_multiset is empty. The vibe check. The "is she running on nothing rn" check ๐Ÿฆ‹ (note: noexcept, she's not gonna throw at you for asking ๐Ÿ’…)


end โ€” const version

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
const_iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::end () const

[inline], [noexcept]

Returns a read-only (constant) iterator that points one past the last element in the unordered_multiset. The finish line, the end credits, the "go home everybody" โœจ


end โ€” non-const version

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::end ()

[inline], [noexcept]

Returns a read-only (constant) iterator that points one past the last element in the unordered_multiset โ€” yep, that's what the docs say for this non-const overload too, don't come for me, I'm just the messenger ๐Ÿ™ˆ

Referenced by std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::extract() โ€” extract girlies stay winning ๐Ÿ‘‘


end โ€” bucket version, non-const

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
local_iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::end (size_type __n)

[inline]

Returns a read-only (constant) iterator pointing to one past the last bucket elements ๐Ÿชฃ

Parameters

  • __n โ€” the bucket index.

Returns

A read-only local iterator.


end โ€” bucket version, const

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
const_local_iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::end (size_type __n) const

[inline]

Returns a read-only (constant) iterator pointing to one past the last bucket elements. Same bucket energy, but now she's const and behaving ๐Ÿ’–

Parameters

  • __n โ€” the bucket index.

Returns

A read-only local iterator.


equal_range โ€” transparent, non-const

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
template<typename _Kt>
auto std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::equal_range (const _Kt &__x)
    -> decltype(_M_h._M_equal_range_tr(__x))

[inline]

Finds a subsequence matching given key. Because multiset can hold dupes, you get a whole range of them, not just one โ€” she ate ๐Ÿ”ฅ

Parameters

  • __x โ€” key to be located.

Returns

Pair of iterators that possibly points to the subsequence matching given key.


equal_range โ€” transparent, const

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
template<typename _Kt>
auto std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::equal_range (const _Kt &__x) const
    -> decltype(_M_h._M_equal_range_tr(__x))

[inline]

Finds a subsequence matching given key. Const flavour, same range, same slay ๐Ÿ’…

Parameters

  • __x โ€” key to be located.

Returns

Pair of iterators that possibly points to the subsequence matching given key.


equal_range โ€” key_type, non-const

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
std::pair<iterator, iterator> std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::equal_range (const key_type &__x)

[inline]

Finds a subsequence matching given key. Hands you back a std::pair<iterator, iterator> โ€” begin-of-the-club and end-of-the-club ๐ŸŽ€

Parameters

  • __x โ€” key to be located.

Returns

Pair of iterators that possibly points to the subsequence matching given key.


equal_range โ€” key_type, const

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
std::pair<const_iterator, const_iterator> std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::equal_range (const key_type &__x) const

[inline]

Finds a subsequence matching given key. Const pair version โ€” read-only, look but don't touch ๐ŸŒธ

Parameters

  • __x โ€” key to be located.

Returns

Pair of iterators that possibly points to the subsequence matching given key.


erase โ€” by key

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
size_type std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::erase (const key_type &__x)

[inline]

Erases elements according to the provided key. And because she's a multiset, this wipes out all the elements located by that key โ€” every last one of them ๐Ÿ’€โœจ

Parameters

  • __x โ€” key of element to be erased.

Returns

The number of elements erased.

This function erases all the elements located by the given key from an unordered_multiset.

โš ๏ธ Real talk: 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. She is not your memory manager, bestie ๐Ÿซถ

erase โ€” range

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::erase (const_iterator __first, const_iterator __last)

[inline]

Erases a [__first,__last) range of elements from an unordered_multiset. Note the square bracket on the left and the round one on the right โ€” __first is in, __last is not ๐Ÿ’…

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.

This function erases a sequence of elements from an unordered_multiset.

โš ๏ธ Again: 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. No cap ๐Ÿงš

erase โ€” single position

template<typename _Value, typename _Hash = hash<_Value>, typename _Pred = equal_to<_Value>, typename _Alloc = allocator<_Value>>
iterator std::unordered_multiset<_Value, _Hash, _Pred, _Alloc>::erase (const_iterator __position)

[inline]

Erases an element from an unordered_multiset โ€” just the one, targeted, surgical, main character energy ๐Ÿ”ฅ

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_multiset.

โš ๏ธ And one more time 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 _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::erase (iterator
    __position) [inline]

Okay so this one deletes one single element out of your unordered_multiset. Just one. Not a range, bestie, we're being surgical here ๐Ÿ’…

Parameters

  • __position โ€” the iterator pointing at the element you want gone โœจ

Returns

An iterator pointing to the element that came immediately after __position before it got erased. And if there's no such element? You get end() back. That's it, that's the deal ๐ŸŽ€

So like โ€” this function erases the element that the iterator you handed it points to, from the unordered_multiset. Simple as.

โš ๏ธ Important vibe check: this only erases the element. 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. It is not gonna clean up after you, bestie ๐Ÿ˜ญ

๐Ÿฆ‹ extract (const key_type & __key)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> node_type
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::extract (const
    key_type & __key) [inline]

Extract a node ๐Ÿซถ โ€” literally the whole description, that's the entire documented behaviour. Short and iconic.


๐Ÿงš extract (const_iterator __pos)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> node_type
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::extract
    (const_iterator __pos) [inline]

Extract a node โœจ same energy, different argument.

References: std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::end()


๐Ÿ’œ find (const _Kt & __x) โ€” the transparent one

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>>
    template<typename _Kt > auto std::unordered_multiset< _Value, _Hash,
    _Pred, _Alloc >::find (const _Kt & __x) ->
    decltype(_M_h._M_find_tr(__x))
          [inline]

Tries to locate an element in an unordered_multiset ๐Ÿ”

Parameters

  • __x โ€” the element we're hunting for

Returns

Iterator pointing to the sought-after element, or end() if it's not found ๐Ÿ˜ญ

So the way this works: you hand it a key, and it goes and tries to locate the element that this key matches. If it succeeds โ€” slay โ€” you get an iterator pointing right at the thing you were looking for. If it fails? You get the past-the-end (end()) iterator. Not found, no drama, just end() ๐Ÿ’€


๐ŸŒˆ find (const _Kt & __x) const โ€” same but const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>>
    template<typename _Kt > auto std::unordered_multiset< _Value, _Hash,
    _Pred, _Alloc >::find (const _Kt & __x) const ->
    decltype(_M_h._M_find_tr(__x))
          [inline]

Tries to locate an element in an unordered_multiset ๐Ÿ” (const edition, she's not changing anything)

Parameters

  • __x โ€” the element to be located

Returns

Iterator pointing to the sought-after element, or end() if not found ๐Ÿ’…

Same whole situation as above: takes a key, tries to locate the matching element, hands you an iterator if it wins, hands you end() if it doesn't โœจ


๐Ÿ“ find (const key_type & __x)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::find (const
    key_type & __x) [inline]

Tries to locate an element in an unordered_multiset ๐ŸŽ€

Parameters

  • __x โ€” element to be located

Returns

Iterator pointing to sought-after element, or end() if not found

Key goes in, iterator comes out (hopefully). Match found = iterator to the element. No match = past-the-end (end()) iterator. Periodt ๐Ÿ’…


๐ŸŽ€ find (const key_type & __x) const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> const_iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::find (const
    key_type & __x) const [inline]

Tries to locate an element in an unordered_multiset ๐ŸŒธ

Parameters

  • __x โ€” element to be located

Returns

Iterator pointing to sought-after element, or end() if not found

Const-flavoured, same behaviour, still returns that past-the-end (end()) iterator when the key simply isn't there ๐Ÿ™ˆ


๐Ÿ‘‘ get_allocator () const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> allocator_type
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::get_allocator
    () const [inline],  [noexcept]

Returns the allocator object that the unordered_multiset is using ๐Ÿซถ That's it. That's the whole function. noexcept too, so she's chill about it โœจ


โญ hash_function () const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> hasher
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::hash_function
    () const [inline]

Returns the hash functor object that the unordered_multiset was constructed with ๐Ÿ’œ So you can see exactly which hasher is running the show.


๐Ÿ”ฅ insert (_InputIterator __first, _InputIterator __last)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>>
    template<typename _InputIterator > void std::unordered_multiset< _Value,
    _Hash, _Pred, _Alloc >::insert (_InputIterator __first, _InputIterator
    __last) [inline]

A template function that inserts a range of elements โœจ bulk insertion era

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 (const value_type & __x)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::insert (const
    value_type & __x) [inline]

Inserts an element into the unordered_multiset ๐Ÿ’…

Parameters

  • __x โ€” element to be inserted

Returns

An iterator that points to the inserted element ๐Ÿซถ

Complexity: insertion requires amortized constant time โšก


๐ŸŒธ insert (const_iterator __hint, const value_type & __x)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::insert
    (const_iterator __hint, const value_type & __x) [inline]

Inserts an element into the unordered_multiset ๐ŸŽ€

Parameters

  • __hint โ€” an iterator that serves as a hint as to where the element should be inserted
  • __x โ€” element to be inserted

Returns

An iterator that points to the inserted element โœจ

So the tea on __hint: that first parameter is only a hint โ€” it can potentially improve the performance of the insertion process, but a bad hint causes no gains in efficiency ๐Ÿ˜ญ so don't stress if yours is mid.

For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints

Complexity: insertion requires amortized constant โšก


๐Ÿงš insert (const_iterator __hint, node_type && __nh)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::insert
    (const_iterator __hint, node_type && __nh) [inline]

Re-insert an extracted node ๐Ÿฆ‹ putting the node back where it belongs

References: std::move()


๐Ÿ’œ insert (const_iterator __hint, value_type && __x)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::insert
    (const_iterator __hint, value_type && __x) [inline]

Inserts an element into the unordered_multiset (move-y flavour) ๐Ÿ’…

Parameters

  • __hint โ€” an iterator that serves as a hint as to where the element should be inserted
  • __x โ€” element to be inserted

Returns

An iterator that points to the inserted element

Same hint situation as before, bestie: first parameter is only a hint, it can potentially improve insertion performance, and a bad hint would cause no gains in efficiency ๐Ÿ™ˆ

For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints

Complexity: insertion requires amortized constant โšก

References: std::move()


๐ŸŒˆ insert (initializer_list<value_type> __l)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> void
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::insert
    (initializer_list< value_type > __l) [inline]

Inserts a list of elements into the unordered_multiset โœจ curly-brace girlies this one's for you ๐ŸŽ€

Parameters

  • __l โ€” a std::initializer_list<value_type> of elements to be inserted

Complexity: similar to that of the range constructor ๐Ÿซถ


โญ insert (node_type && __nh)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::insert
    (node_type && __nh) [inline]

Re-insert an extracted node ๐Ÿงš no hint this time, she just goes

References: std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::cend(), and std::move()


๐Ÿ“ insert (value_type && __x)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> iterator
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::insert
    (value_type && __x) [inline]

Inserts an element into the unordered_multiset ๐Ÿ’–

Parameters

  • __x โ€” element to be inserted

Returns

An iterator that points to the inserted element

Complexity: insertion requires amortized constant time โšก

References: std::move()


๐Ÿฆ‹ key_eq () const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> key_equal
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::key_eq () const
    [inline]

Returns the key comparison object that the unordered_multiset was constructed with ๐Ÿ‘‘ so you can peek at whichever predicate is deciding what counts as "equal" around here.


๐ŸŽ€ load_factor () const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> float
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::load_factor ()
    const [inline],  [noexcept]

Returns the average number of elements per bucket ๐Ÿ“Š your buckets-to-elements ratio, basically. noexcept, so no surprises โœจ


๐Ÿ’€ max_bucket_count () const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> size_type
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc
    >::max_bucket_count () const [inline],  [noexcept]

Returns the maximum number of buckets of the unordered_multiset ๐Ÿชฃ the absolute ceiling, the bucket limit, the whole thing. noexcept too ๐Ÿ’…


๐ŸŒธ max_load_factor () const

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> float
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::max_load_factor
    () const [inline],  [noexcept]

Returns a positive number that the unordered_multiset tries to keep the load factor less than or equal to ๐ŸŽฏ it's the ceiling she's aiming under, not a promise, a tries. noexcept โœจ


๐Ÿ”ฅ max_load_factor (float __z)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
    equal_to<_Value>, typename _Alloc  = allocator<_Value>> void
    std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::max_load_factor
    (float __z) [inline]

Change the unordered_multiset maximum load factor ๐Ÿ› ๏ธ the setter version โ€” you pass in __z and that's the new ceiling she'll try to stay under. Same name, different job, iykyk ๐Ÿ’…

Catching the tail end of the one above โ€” Parameters:

  • __z โ€” the new maximum load factor.

๐Ÿ’– max_size

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>> size_type
std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::max_size ()
const [inline],  [noexcept]

Returns the maximum size of the unordered_multiset. That's it, that's the whole vibe โ€” the biggest this container could ever get. noexcept too, so she's chill about it โœจ


๐ŸŽ€ operator= (copy)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>>
unordered_multiset & std::unordered_multiset< _Value, _Hash, _Pred,
_Alloc >::operator= (const unordered_multiset< _Value, _Hash, _Pred,
_Alloc > &) [default]

Copy assignment operator. Classic. She takes the other multiset's whole personality and becomes it ๐Ÿ’… Defaulted, so the compiler writes the boring parts for her.


๐ŸŒธ operator= (initializer_list)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>>
unordered_multiset & std::unordered_multiset< _Value, _Hash, _Pred,
_Alloc >::operator= (initializer_list< value_type > __l) [inline]

Unordered_multiset list assignment operator โ€” the "here's a lil list, bestie, take it all" move ๐Ÿซถ

Parameters

  • __l โ€” An initializer_list.

This function fills an unordered_multiset with copies of the elements in the initializer list __l.

Heads up babes: the assignment completely changes the unordered_multiset, and the resulting unordered_multiset's size is the same as the number of elements assigned. So likeโ€ฆ nothing survives from before. Total glow-up, no leftovers โœจ

๐Ÿฆ‹ operator= (move)

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>>
unordered_multiset & std::unordered_multiset< _Value, _Hash, _Pred,
_Alloc >::operator= (unordered_multiset< _Value, _Hash, _Pred, _Alloc >
&&) [default]

Move assignment operator. She yoinks the other one's whole existence. Defaulted, zero notes ๐Ÿ’€


๐Ÿ”ฅ rehash

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>> void
std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::rehash
(size_type __n) [inline]

May rehash the unordered_multiset. Emphasis on may โ€” she's not committing to anything, it's giving conditional queen ๐Ÿ‘‘

Parameters

  • __n โ€” The new number of buckets.

Rehash will occur only if the new number of buckets respect the unordered_multiset maximum load factor. No wishes, no vibes โ€” the load factor said no, so she's not doing it.


๐Ÿงš reserve

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>> void
std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::reserve
(size_type __n) [inline]

Prepare the unordered_multiset for a specified number of elements. Like packing your bag before the trip instead of panicking at the airport ๐ŸŽ€

Parameters

  • __n โ€” Number of elements required.

Same as rehash(ceil(n / max_load_factor())). Literally that. Do the math, she already did ๐Ÿงฎ


โญ size

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>> size_type
std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::size () const
[inline],  [noexcept]

Returns the size of the unordered_multiset. How many besties are in the group chat. const and noexcept, so she won't surprise you ๐Ÿ’œ


๐ŸŒˆ swap

template<typename _Value , typename _Hash  = hash<_Value>, typename _Pred  =
equal_to<_Value>, typename _Alloc  = allocator<_Value>> void
std::unordered_multiset< _Value, _Hash, _Pred, _Alloc >::swap
(unordered_multiset< _Value, _Hash, _Pred, _Alloc > & __x) [inline],
[noexcept]

Swaps data with another unordered_multiset. Two multisets, one trade, everyone eats ๐Ÿ”ฅ

Parameters

  • __x โ€” An unordered_multiset of the same element and allocator types. (Same element type, same allocator type โ€” she's picky about her company, iykyk.)

This exchanges the elements between two sets in constant time. Obsessed. And note that the global std::swap() function is specialized such that std::swap(s1,s2) will feed to this function โ€” so you can just call the global one and she'll handle it, no cap ๐Ÿซถ


๐Ÿ‘‘ Author

Generated automatically by Doxygen for libstdc++ from the source code. (Not a human, not a girlie, just a doc generator doing her lil thing ๐Ÿ’…)


and that's the whole page, bestie โœจ This little love letter lives in the libstdc++ man pages as std::unordered_multiset<...>(3cxx) โ€” same source, same version-and-date energy, just delivered with way more sparkle ๐ŸŽ€ Go forth and multiset responsibly ๐Ÿฆ‹๐Ÿ’–
๐Ÿ“ฆ where this page comes from