STD::MULTIMAP(3cxx)
π NAME π
Okay bestie, welcome to the <pink>std::multimap< ...mpare, _Alloc >(3cxx)</pink> manual page β yes, that long adorable thing is the manual name, and we're folding it in right here instead of copying the header line. std::multimap< _Key, _Tp, _Compare, _Alloc >is a standard container made up of(key,value)` pairs, which can be retrieved based on a key, in logarithmic time. Periodt. π
β¨ SYNOPSIS β¨
#include <map>
πΈ Public Types πΈ
typedef _Alloc allocator_typeβ the allocator type.typedef _Rep_type::const_iterator const_iteratorβ const iterator.typedef _Alloc_traits::const_pointer const_pointerβ const pointer.typedef _Alloc_traits::const_reference const_referenceβ const reference.typedef _Rep_type::const_reverse_iterator const_reverse_iteratorβ const reverse iterator.typedef _Rep_type::difference_type difference_typeβ difference type.typedef _Rep_type::iterator iteratorβ iterator.typedef _Compare key_compareβ key comparison type.typedef _Key key_typeβ key type.typedef _Tp mapped_typeβ mapped type.using node_type = typename _Rep_type::node_typeβ node type.typedef _Alloc_traits::pointer pointerβ pointer.typedef _Alloc_traits::reference referenceβ reference.typedef _Rep_type::reverse_iterator reverse_iteratorβ reverse iterator.typedef _Rep_type::size_type size_typeβ size type.typedef std::pair< const _Key, _Tp > value_typeβ value type.
π Public Member Functions π
Where the original gives no extra blurb, I'm just leaving the signature looking cute β no invented facts, no cap. π«Ά
multimap ()=defaultβ default constructor, creates no elements. Empty from the jump.template<typename _InputIterator > multimap (_InputIterator __first, _InputIterator __last)β builds a multimap from a range.template<typename _InputIterator > multimap (_InputIterator __first, _InputIterator __last, const _Compare &__comp, const allocator_type &__a=allocator_type())β builds a multimap from a range.template<typename _InputIterator > multimap (_InputIterator __first, _InputIterator __last, const allocator_type &__a)β allocator-extended range constructor.multimap (const _Compare &__comp, const allocator_type &__a=allocator_type())β creates a multimap with no elements.multimap (const allocator_type &__a)β allocator-extended default constructor.multimap (const multimap &)=defaultβ multimap copy constructor.multimap (const multimap &__m, const __type_identity_t< allocator_type > &__a)β allocator-extended copy constructor.multimap (initializer_list< value_type > __l, const _Compare &__comp=_Compare(), const allocator_type &__a=allocator_type())β builds a multimap from aninitializer_list.multimap (initializer_list< value_type > __l, const allocator_type &__a)β allocator-extended initialier-list constructor.multimap (multimap &&)=defaultβ multimap move constructor.multimap (multimap &&__m, const __type_identity_t< allocator_type > &__a) noexcept(is_nothrow_copy_constructible< _Compare >::value &&_Alloc_traits::_S_always_equal())β allocator-extended move constructor.~multimap ()=defaultconst_iterator begin () const noexceptiterator begin () noexceptconst_iterator cbegin () const noexceptconst_iterator cend () const noexceptvoid clear () noexceptconst_reverse_iterator crbegin () const noexceptconst_reverse_iterator crend () const noexcepttemplate<typename... _Args> iterator emplace (_Args &&... __args)β build and insert astd::pairinto the multimap.template<typename... _Args> iterator emplace_hint (const_iterator __pos, _Args &&... __args)β builds and inserts astd::pairinto the multimap.bool empty () const noexceptconst_iterator end () const noexceptiterator end () noexceptsize_type erase (const key_type &__x)β erases elements according to the provided key.iterator erase (const_iterator __first, const_iterator __last)β erases a[first,last)range of elements from a multimap.node_type extract (const key_type &__x)β extract a node.node_type extract (const_iterator __pos)β extract a node.allocator_type get_allocator () const noexceptβ get a copy of the memory allocation object.template<typename _InputIterator > void insert (_InputIterator __first, _InputIterator __last)β a template function that attempts to insert a range of elements.iterator insert (const_iterator __hint, node_type &&__nh)β re-insert an extracted node.void insert (initializer_list< value_type > __l)β attempts to insert a list ofstd::pairs into the multimap.iterator insert (node_type &&__nh)β re-insert an extracted node.key_compare key_comp () constsize_type max_size () const noexcepttemplate<typename _Cmp2 > void merge (map< _Key, _Tp, _Cmp2, _Alloc > &&__source)template<typename _Cmp2 > void merge (map< _Key, _Tp, _Cmp2, _Alloc > &__source)template<typename _Cmp2 > void merge (multimap< _Key, _Tp, _Cmp2, _Alloc > &&__source)template<typename _Cmp2 > void merge (multimap< _Key, _Tp, _Cmp2, _Alloc > &__source)multimap & operator= (const multimap &)=defaultβ multimap assignment operator.multimap & operator= (initializer_list< value_type > __l)β multimap list assignment operator.multimap & operator= (multimap &&)=defaultβ move assignment operator.const_reverse_iterator rbegin () const noexceptreverse_iterator rbegin () noexceptconst_reverse_iterator rend () const noexceptreverse_iterator rend () noexceptsize_type size () const noexceptvoid swap (multimap &__x) noexcept(/*conditional */)β swaps data with another multimap.value_compare value_comp () const
π The extra overload block (still Public Member Functions) π
The original drops these below value_comp() β they're still part of the Public Member Functions list, so we're keeping every single one. π
iterator insert (const value_type &__x)β inserts astd::pairinto the multimap.iterator insert (value_type &&__x)β inserts astd::pairinto the multimap.template<typename _Pair > __enable_if_t< is_constructible< value_type, _Pair >::value, iterator > insert (_Pair &&__x)β inserts astd::pairinto the multimap.iterator insert (const_iterator __position, const value_type &__x)β inserts astd::pairinto the multimap.iterator insert (const_iterator __position, value_type &&__x)β inserts astd::pairinto the multimap.template<typename _Pair > __enable_if_t< is_constructible< value_type, _Pair && >::value, iterator > insert (const_iterator __position, _Pair &&__x)β inserts astd::pairinto the multimap.iterator erase (const_iterator __position)β erases an element from a multimap._GLIBCXX_ABI_TAG_CXX11 iterator erase (iterator __position)β erases an element from a multimap.iterator find (const key_type &__x)β tries to locate an element in a multimap.template<typename _Kt > auto find (const _Kt &__x) -> decltype(_M_t._M_find_tr(__x))β tries to locate an element in a multimap.const_iterator find (const key_type &__x) constβ tries to locate an element in a multimap.template<typename _Kt > auto find (const _Kt &__x) const -> decltype(_M_t._M_find_tr(__x))β tries to locate an element in a multimap.size_type count (const key_type &__x) constβ finds the number of elements with given key.template<typename _Kt > auto count (const _Kt &__x) const -> decltype(_M_t._M_count_tr(__x))β finds the number of elements with given key.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_t._M_find_tr(__x), void(), true)β finds whether an element with the given key exists.iterator lower_bound (const key_type &__x)β finds the beginning of a subsequence matching given key.template<typename _Kt > auto lower_bound (const _Kt &__x) -> decltype(iterator(_M_t._M_lower_bound_tr(__x)))β finds the beginning of a subsequence matching given key.const_iterator lower_bound (const key_type &__x) constβ finds the beginning of a subsequence matching given key.template<typename _Kt > auto lower_bound (const _Kt &__x) const -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))β finds the beginning of a subsequence matching given key.iterator upper_bound (const key_type &__x)β finds the end of a subsequence matching given key.template<typename _Kt > auto upper_bound (const _Kt &__x) -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))β finds the end of a subsequence matching given key.const_iterator upper_bound (const key_type &__x) constβ finds the end of a subsequence matching given key.template<typename _Kt > auto upper_bound (const _Kt &__x) const -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))β finds the end of a subsequence matching given key.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(pair< iterator, iterator >(_M_t._M_equal_range_tr(__x)))β finds a subsequence matching given key.std::pair< const_iterator, const_iterator > equal_range (const key_type &__x) constβ finds a subsequence matching given key.template<typename _Kt > auto equal_range (const _Kt &__x) const -> decltype(pair< const_iterator, const_iterator >(_M_t._M_equal_range_tr(__x)))β finds a subsequence matching given key.
π¦ Friends π¦
template<typename _K1 , typename _T1 , typename _C1 , typename _A1 > bool operator< (const multimap< _K1, _T1, _C1, _A1 > &, const multimap< _K1, _T1, _C1, _A1 > &)template<typename _K1 , typename _T1 , typename _C1 , typename _A1 > bool operator== (const multimap< _K1, _T1, _C1, _A1 > &, const multimap< _K1, _T1, _C1, _A1 > &)template<typename , typename > struct std::_Rb_tree_merge_helper
π₯ Detailed Description π₯
template<typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
class std::multimap< _Key, _Tp, _Compare, _Alloc >
Since: C++98
π§ Template Parameters π§
_Keyβ type of key objects._Tpβ type of mapped objects._Compareβ comparison function object type, defaults toless<_Key>._Allocβ allocator type, defaults toallocator<pair<const _Key, _Tp>.
It meets the requirements of a container, a reversible container, and an associative container (using equivalent keys). For a multimap<Key,T> the key_type is Key, the mapped_type is T, and the value_type is std::pair<const Key,T>.
Multimaps support bidirectional iterators. π¦
The private tree data is declared exactly the same way for map and multimap; the distinction is made entirely in how the tree functions are called (*_unique versus *_equal, same as the standard).
π Constructor & Destructor Documentation π
okay bestie, buckle up, this is where the multimap gets built ποΈβ¨ Every single one of these is a way to birth a multimap, and yes there are like a MILLION of them, but they're all just variations on a vibe, iykyk.
πΈ multimap () β the default one
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap ()
[default]
Default constructor creates no elements. That's it. Empty girlie. Zero thoughts, head empty, no cap π She exists, she's valid, she holds literally nothing.
π multimap (const _Compare & __comp, const allocator_type & __a = allocator_type())
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap (const
_Compare & __comp, const allocator_type & __a = allocator_type())
[inline], [explicit]
Creates a multimap with no elements β but this time you get to hand-pick your comparison object and your allocator. Custom order, custom memory, custom everything π¦
Parameters
__compβ A comparison object.__aβ An allocator object.
Heads up: this one is marked [explicit], so no sneaky implicit conversions, bestie. Say what you mean.
π multimap (const multimap< _Key, _Tp, _Compare, _Alloc > &)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap (const
multimap< _Key, _Tp, _Compare, _Alloc > &) [default]
Multimap copy constructor. Twin energy π―ββοΈ Whether the allocator is copied depends on the allocator traits β so like, the allocator situation is between you and allocator_traits, not me.
π₯ multimap (multimap< _Key, _Tp, _Compare, _Alloc > &&)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap
(multimap< _Key, _Tp, _Compare, _Alloc > &&) [default]
Multimap move constructor. The newly-created multimap contains the exact contents of the moved instance. The moved instance is a valid, but unspecified multimap β so like, she's alive, she's legal, but do NOT ask her what's in her bag because nobody knows, not even her π
β¨ multimap (initializer_list< value_type > __l, const _Compare & __comp = _Compare(), const allocator_type & __a = allocator_type())
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap
(initializer_list< value_type > __l, const _Compare & __comp =
_Compare(), const allocator_type & __a = allocator_type()) [inline]
Builds a multimap from an initializer_list. Brace-init girlies, this one's for you π
Parameters
__lβ An initializer_list.__compβ A comparison functor.__aβ An allocator object.
Create a multimap consisting of copies of the elements from the initializer_list. This is linear in N if the list is already sorted, and NlogN otherwise (where N is __l.size()). So if you sorted it first, slay, free speedrun β‘
π¦ multimap (const allocator_type & __a)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap (const
allocator_type & __a) [inline], [explicit]
Allocator-extended default constructor. Same empty mood, but with your allocator. Also [explicit], so keep it intentional π
π§ multimap (const multimap< _Key, _Tp, _Compare, _Alloc > & __m, const __type_identity_t< allocator_type > & __a)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap (const
multimap< _Key, _Tp, _Compare, _Alloc > & __m, const __type_identity_t<
allocator_type > & __a) [inline]
Allocator-extended copy constructor. Copy the vibe, but pick your own memory manager π«Ά
β multimap (multimap< _Key, _Tp, _Compare, _Alloc > && __m, const __type_identity_t< allocator_type > & __a)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap
(multimap< _Key, _Tp, _Compare, _Alloc > && __m, const
__type_identity_t< allocator_type > & __a) [inline], [noexcept]
Allocator-extended move constructor. And it's [noexcept], which is basically the C++ way of saying "no drama, guaranteed" π₯
π multimap (initializer_list< value_type > __l, const allocator_type & __a)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::multimap
(initializer_list< value_type > __l, const allocator_type & __a)
[inline]
Allocator-extended initialier-list constructor. Yes, the docs said "initialier" β iconic typo, we respect the original author's whole thing π
π template<typename _InputIterator > multimap (_InputIterator __first, _InputIterator __last, const allocator_type & __a)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _InputIterator > std::multimap< _Key, _Tp,
_Compare, _Alloc >::multimap (_InputIterator __first, _InputIterator
__last, const allocator_type & __a) [inline]
Allocator-extended range constructor. Range + your own allocator. Chef's kiss π
π template<typename _InputIterator > multimap (_InputIterator __first, _InputIterator __last)
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _InputIterator > std::multimap< _Key, _Tp,
_Compare, _Alloc >::multimap (_InputIterator __first, _InputIterator
__last) [inline]
Builds a multimap from a range. The classic. The blueprint. The moment π«Ά
Parameters
__firstβ An input iterator.__lastβ An input iterator.
Create a multimap consisting of copies of the elements from [__first,__last). This is linear in N if the range is already sorted, and NlogN otherwise (where N is distance(__first,__last)). Sorted input = instant slay β‘
π template<typename _InputIterator > multimap (_InputIterator __first, _InputIterator __last, const _Compare & __comp, const allocator_type & __a = allocator_type())
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _InputIterator > std::multimap< _Key, _Tp,
_Compare, _Alloc >::multimap (_InputIterator __first, _InputIterator
__last, const _Compare & __comp, const allocator_type & __a =
allocator_type()) [inline]
Builds a multimap from a range β with the full custom treatment: comparison functor and allocator. Main character constructor energy π
Parameters
__firstβ An input iterator.__lastβ An input iterator.__compβ A comparison functor.__aβ An allocator object.
Create a multimap consisting of copies of the elements from [__first,__last). This is linear in N if the range is already sorted, and NlogN otherwise (where N is distance(__first,__last)). Same deal as before, no cap π
π ~multimap ()
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> std::multimap< _Key, _Tp, _Compare, _Alloc >::~multimap ()
[default]
The dtor only erases the elements, and note that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility. π«΅
β οΈ This is the big one, bestie. She deletes the elements, not the stuff your pointers are pointing at. If you leaked, that's on you. The destructor is not your cleanup crew, she's just closing the tab π
π Member Function Documentation π
β begin () const
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::begin () const [inline], [noexcept]
Returns a read-only (constant) iterator that points to the first pair in the multimap. Iteration is done in ascending order according to the keys. Read-only girlie, look but don't touch πβ¨
π₯ begin ()
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::begin ()
[inline], [noexcept]
Returns a read/write iterator that points to the first pair in the multimap. Iteration is done in ascending order according to the keys. Now you can touch π (well, the mapped values at least β key is const, as always)
π¦ cbegin () const
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::cbegin () const [inline], [noexcept]
Returns a read-only (constant) iterator that points to the first pair in the multimap. Iteration is done in ascending order according to the keys. Literally the same energy as begin() const, just with a c for commitment π
πΈ cend () const
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::cend () const [inline], [noexcept]
Returns a read-only (constant) iterator that points one past the last pair in the multimap. Iteration is done in ascending order according to the keys. One-past-the-end, the classic "you've reached the end of the scroll" marker π«Ά
π clear ()
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> void std::multimap< _Key, _Tp, _Compare, _Alloc >::clear ()
[inline], [noexcept]
Erases all elements in a multimap. Note that this function only erases the elements, and that if the elements themselves are pointers, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility.
β οΈ Same warning as the destructor: clear() wipes the entries, NOT whatever your pointers point at. If you expected free memory cleanup, she said no π«΅π
β¨ contains () β the _Kt flavor
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Kt > auto std::multimap< _Key, _Tp, _Compare,
_Alloc >::contains (const _Kt & __x) const ->
decltype(_M_t._M_find_tr(__x), void(), true)
[inline]
Finds whether an element with the given key exists. Returns true or false β she's a yes/no girlie, no maybe π
Parameters
__xβ Key of (key, value) pairs to be located.
Returns
True if there is any element with the specified key.
π contains (const key_type & __x) const
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> bool std::multimap< _Key, _Tp, _Compare, _Alloc >::contains
(const key_type & __x) const [inline]
Finds whether an element with the given key exists. The plain-bool version, because sometimes you just want the answer without the decltype poetry β¨
Parameters
__xβ Key of (key, value) pairs to be located.
Returns
True if there is any element with the specified key.
π₯ count () β the _Kt flavor
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Kt > auto std::multimap< _Key, _Tp, _Compare,
_Alloc >::count (const _Kt & __x) const ->
decltype(_M_t._M_count_tr(__x))
[inline]
Finds the number of elements with given key. This is a *multi*map bestie β duplicates are literally the whole point, so the answer can absolutely be more than 1 π―ββοΈπ―ββοΈπ―ββοΈ
Parameters
__xβ Key of (key, value) pairs to be located.
Returns
Number of elements with specified key.
π count (const key_type & __x) const
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> size_type std::multimap< _Key, _Tp, _Compare, _Alloc >::count
(const key_type & __x) const [inline]
Finds the number of elements with given key. Returns a size_type, so it's the same answer, just wearing a different outfit π
Parameters
__xβ Key of (key, value) pairs to be located.
Returns
Number of elements with specified key.
π crbegin () const
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_reverse_iterator std::multimap< _Key, _Tp, _Compare,
_Alloc >::crbegin () const [inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to the last pair in the multimap. Iteration is done in descending order according to the keys. Going backwards, read-only, no notes π
π§ crend () const
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_reverse_iterator std::multimap< _Key, _Tp, _Compare,
_Alloc >::crend () const [inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to one before the first pair in the multimap. Iteration is done in descending order according to the keys. Yeah, "one before the first" β reverse iterators are built different, don't think about it too hard π
π emplace ()
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename... _Args> iterator std::multimap< _Key, _Tp,
_Compare, _Alloc >::emplace (_Args &&... __args) [inline]
Build and insert a std::pair into the multimap. Construct in place, no temporary, no extra copy β that's the whole flex ποΈπ₯
Parameters
__argsβ Arguments used to generate a new pair instance (seestd::piecewise_contructfor passing arguments to each part of the pair constructor).
Ngl the docs say std::piecewise_contruct there and we are keeping it exactly as written, bestie. Iconic. π
Returns
An iterator that points to the inserted (key,value) pair.
This one builds a (key, value) pair and yeets it straight into the multimap π And see, unlike std::map, the multimap is not out here demanding unique keys β so bestie, you can absolutely have multiple pairs with the same key chilling together. No gatekeeping here. β¨
Insertion requires logarithmic time.
emplace_hint
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
template<typename... _Args>
iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::emplace_hint (const_iterator __pos, _Args &&... __args) [inline]
Builds a std::pair and slots it into the multimap. π
Parameters
__posβ an iterator that acts as a hint about where the pair should be inserted.__argsβ the arguments used to generate a new pair instance (peepstd::piecewise_contructfor passing arguments to each part of the pair constructor).
Returns
An iterator pointing at the inserted (key, value) pair.
So like, this function inserts a (key, value) pair into the multimap, and β contrary to std::map β the multimap does not rely on unique keys, so multiple pairs with the same key can be inserted. πΈ Also important: that first parameter is only a hint, okay? It can potentially improve performance of the insertion, but a bad hint would cause no gains in efficiency. It's giving "suggestion, not a demand" energy.
For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints
Insertion requires logarithmic time (if the hint is not taken). π
empty
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
bool std::multimap< _Key, _Tp, _Compare, _Alloc >::empty () const [inline], [noexcept]
Returns true if the multimap is empty. That's it. That's the whole vibe check. π«Ά
end (const version)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
const_iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::end () const [inline], [noexcept]
Gives you a read-only (constant) iterator that points one past the last pair in the multimap. Iteration happens in ascending order according to the keys. β
end
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::end () [inline], [noexcept]
Same deal but read/write β a read/write iterator pointing one past the last pair in the multimap, and iteration is done in ascending order according to the keys. π₯
Referenced by std::multimap< _Key, _Tp, _Compare, _Alloc >::extract().
equal_range (templated, _Kt)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
template<typename _Kt >
auto std::multimap< _Key, _Tp, _Compare, _Alloc >::equal_range (const _Kt & __x)
-> decltype(pair<iterator, iterator>(_M_t._M_equal_range_tr(__x)))
[inline]
Finds a subsequence matching the given key. π¦
Parameters
__xβ key of the (key, value) pairs to be located.
Returns
A pair of iterators that possibly points to the subsequence matching the given key.
This function is equivalent to:
std::make_pair(c.lower_bound(val),
c.upper_bound(val))
(but it's faster than making the calls separately, so likeβ¦ slay, efficiency π ).
equal_range (templated, _Kt, const)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
template<typename _Kt >
auto std::multimap< _Key, _Tp, _Compare, _Alloc >::equal_range (const _Kt & __x) const
-> decltype(pair<const_iterator, const_iterator>(
_M_t._M_equal_range_tr(__x)))
[inline]
Finds a subsequence matching the given key, but make it const. β¨
Parameters
__xβ key of the (key, value) pairs to be located.
Returns
A pair of read-only (constant) iterators that possibly points to the subsequence matching the given key.
Equivalent to:
std::make_pair(c.lower_bound(val),
c.upper_bound(val))
(but faster than making the calls separately β no cap).
equal_range (key_type)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
std::pair< iterator, iterator > std::multimap< _Key, _Tp, _Compare, _Alloc >::equal_range (const key_type & __x) [inline]
Finds a subsequence matching the given key. π
Parameters
__xβ key of the (key, value) pairs to be located.
Returns
A pair of iterators that possibly points to the subsequence matching the given key.
Equivalent to:
std::make_pair(c.lower_bound(val),
c.upper_bound(val))
(but faster than making the calls separately β obsessed).
equal_range (key_type, const)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
std::pair< const_iterator, const_iterator > std::multimap< _Key, _Tp, _Compare, _Alloc >::equal_range (const key_type & __x) const [inline]
Finds a subsequence matching the given key, read-only edition. π
Parameters
__xβ key of the (key, value) pairs to be located.
Returns
A pair of read-only (constant) iterators that possibly points to the subsequence matching the given key.
Equivalent to:
std::make_pair(c.lower_bound(val),
c.upper_bound(val))
(but faster than making the calls separately, periodt).
erase (by key)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
size_type std::multimap< _Key, _Tp, _Compare, _Alloc >::erase (const key_type & __x) [inline]
Erases elements according to the provided key. π§
Parameters
__xβ key of the element to be erased.
Returns
The number of elements erased.
This function erases all elements located by the given key from a multimap β yes, all of them, because multimap said no to unique keys, remember? π
Heads up bestie: this function only erases the element. If the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is your responsibility. π
erase (range)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::erase (const_iterator __first, const_iterator __last) [inline]
Erases a [first,last) range of elements from a multimap. π
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 a multimap.
Same warning, and it's important: 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. π
erase (single position, const_iterator)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::erase (const_iterator __position) [inline]
Erases an element from a 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 a multimap.
And again: it only erases the element. If the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility. π«Ά
erase (single position, iterator)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
_GLIBCXX_ABI_TAG_CXX11 iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::erase (iterator __position) [inline]
Erases an element from a multimap β this is the overload carrying the _GLIBCXX_ABI_TAG_CXX11 tag, not me making things up. π₯
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 a multimap.
One more time for the people in the back: it only erases the element. If the element is itself a pointer, the pointed-to memory is not touched in any way. Managing the pointer is the user's responsibility. π
extract (by key)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
node_type std::multimap< _Key, _Tp, _Compare, _Alloc >::extract (const key_type & __x) [inline]
Extract a node. π¦
extract (by position)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
node_type std::multimap< _Key, _Tp, _Compare, _Alloc >::extract (const_iterator __pos) [inline]
Extract a node β this time you point at it instead of naming its key. πΈ
References std::multimap< _Key, _Tp, _Compare, _Alloc >::end().
find (templated, _Kt)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
template<typename _Kt >
auto std::multimap< _Key, _Tp, _Compare, _Alloc >::find (const _Kt & __x)
-> decltype(_M_t._M_find_tr(__x))
[inline]
Tries to locate an element in a multimap. π
Parameters
__xβ key of the (key, value) pair to be located.
Returns
Iterator pointing to the 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 pair. If unsuccessful, it returns the past-the-end (end()) iterator. Lowkey the most relatable function on this page β sometimes you find it, sometimes you get end(). π
find (templated, _Kt, const)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
template<typename _Kt >
auto std::multimap< _Key, _Tp, _Compare, _Alloc >::find (const _Kt & __x) const
-> decltype(_M_t._M_find_tr(__x))
[inline]
Tries to locate an element in a multimap, but read-only. β
Parameters
__xβ key of the (key, value) pair to be located.
Returns
Read-only (constant) iterator pointing to the 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 a constant iterator pointing to the sought-after pair. If unsuccessful, it returns the past-the-end (end()) iterator.
find (key_type)
template<typename _Key , typename _Tp , typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key, _Tp> >>
iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::find (const key_type & __x) [inline]
Tries to locate an element in a multimap. π
Okay so the mutable find β last two deets before we move on:
__xβ key of (key, value) pair to be located.- Returns β iterator pointing to the sought-after element, or
end()if nothing matched.
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 pair. If unsuccessful it returns the past-the-end (end()) iterator.
β¨ find β the read-only twin β¨
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::find (const key_type & __x) const [inline]
Tries to locate an element in a multimap. Same energy, but nobody can touch anything π
__xβ key of (key, value) pair to be located.- Returns β read-only (constant) 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 a constant iterator pointing to the sought after pair. If unsuccessful it returns the past-the-end (end()) iterator.
π get_allocator π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> allocator_type std::multimap< _Key, _Tp, _Compare, _Alloc
>::get_allocator () const [inline], [noexcept]
Get a copy of the memory allocation object. That's it, that's the whole thing β she's a handoff of the allocator, [inline], [noexcept], zero drama π«Ά
πΈ insert β the range version πΈ
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _InputIterator > void std::multimap< _Key,
_Tp, _Compare, _Alloc >::insert (_InputIterator __first, _InputIterator
__last) [inline]
A template function that attempts to insert a range of elements. Bulk drop, bestie π
__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 β single _Pair && flavor π¦
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Pair > __enable_if_t< is_constructible<
value_type, _Pair >::value, iterator > std::multimap< _Key, _Tp,
_Compare, _Alloc >::insert (_Pair && __x) [inline]
Inserts a std::pair into the multimap.
__xβ pair to be inserted (seestd::make_pairfor easy creation of pairs).- Returns β an iterator that points to the inserted (key,value) pair.
This function inserts a (key, value) pair into the multimap. Contrary to a std::map the multimap does not rely on unique keys and thus multiple pairs with the same key can be inserted.
Insertion requires logarithmic time.
π insert β the const value_type & one π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::insert
(const value_type & __x) [inline]
Inserts a std::pair into the multimap. Again. We love a repeat β¨
__xβ pair to be inserted (seestd::make_pairfor easy creation of pairs).- Returns β an iterator that points to the inserted (key,value) pair.
This function inserts a (key, value) pair into the multimap. Contrary to a std::map the multimap does not rely on unique keys and thus multiple pairs with the same key can be inserted.
Insertion requires logarithmic time.
Referenced by std::multimap< _Key, _Tp, _Compare, _Alloc >::insert().
Not me being referenced by myself π that's main character energy fr.
π§ insert β re-inserting an extracted node (hint version) π§
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::insert
(const_iterator __hint, node_type && __nh) [inline]
Re-insert an extracted node. Put it back where it belongs, king π
References std::move().
π insert β hint + _Pair && π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Pair > __enable_if_t< is_constructible<
value_type, _Pair && >::value, iterator > std::multimap< _Key, _Tp,
_Compare, _Alloc >::insert (const_iterator __position, _Pair && __x)
[inline]
Inserts a std::pair into the multimap β this time with a lil hint π«Ά
__positionβ an iterator that serves as a hint as to where the pair should be inserted.__xβ pair to be inserted (seestd::make_pairfor easy creation of pairs).- Returns β an iterator that points to the inserted (key,value) pair.
This function inserts a (key, value) pair into the multimap. Contrary to a std::map the multimap does not rely on unique keys and thus multiple pairs with the same key can be inserted. 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.
For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints
Insertion requires logarithmic time (if the hint is not taken).
end() is the safe default hint if you're stuck, but a bad hint gets you literally nothing. No gains. Zero. π«
π insert β hint + const value_type & π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::insert
(const_iterator __position, const value_type & __x) [inline]
Inserts a std::pair into the multimap.
__positionβ an iterator that serves as a hint as to where the pair should be inserted.__xβ pair to be inserted (seestd::make_pairfor easy creation of pairs).- Returns β an iterator that points to the inserted (key,value) pair.
This function inserts a (key, value) pair into the multimap. Contrary to a std::map the multimap does not rely on unique keys and thus multiple pairs with the same key can be inserted. 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.
For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints
Insertion requires logarithmic time (if the hint is not taken).
β insert β hint + value_type && β
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::insert
(const_iterator __position, value_type && __x) [inline]
Inserts a std::pair into the multimap.
__positionβ an iterator that serves as a hint as to where the pair should be inserted.__xβ pair to be inserted (seestd::make_pairfor easy creation of pairs).- Returns β an iterator that points to the inserted (key,value) pair.
This function inserts a (key, value) pair into the multimap. Contrary to a std::map the multimap does not rely on unique keys and thus multiple pairs with the same key can be inserted. 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.
For more on hinting, see: https://gcc.gnu.org/onlinedocs/libstdc++/manual/associative.html#containers.associative.insert_hints
Insertion requires logarithmic time (if the hint is not taken).
References std::move().
π insert β the initializer_list glow-up π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> void std::multimap< _Key, _Tp, _Compare, _Alloc >::insert
(initializer_list< value_type > __l) [inline]
Attempts to insert a list of std::pairs into the multimap. Brace-init moment π
__lβ astd::initializer_list<value_type>of pairs to be inserted.
Complexity similar to that of the range constructor.
References std::multimap< _Key, _Tp, _Compare, _Alloc >::insert().
π¦ insert β extracted node, no hint needed π¦
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::insert
(node_type && __nh) [inline]
Re-insert an extracted node. Welcome back to the function, bestie πΈ
References std::move().
π₯ insert β the value_type && solo π₯
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc >::insert
(value_type && __x) [inline]
Inserts a std::pair into the multimap.
__xβ pair to be inserted (seestd::make_pairfor easy creation of pairs).- Returns β an iterator that points to the inserted (key,value) pair.
This function inserts a (key, value) pair into the multimap. Contrary to a std::map the multimap does not rely on unique keys and thus multiple pairs with the same key can be inserted.
Insertion requires logarithmic time.
References std::move().
Count 'em β that's the full insert lineup. Nobody got skipped, nobody got merged. Slay π
π key_comp π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> key_compare std::multimap< _Key, _Tp, _Compare, _Alloc
>::key_comp () const [inline]
Returns the key comparison object out of which the multimap was constructed. Like, hand me the little comparator that birthed this whole vibe check π
π lower_bound β the transparent/mutable one π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Kt > auto std::multimap< _Key, _Tp, _Compare,
_Alloc >::lower_bound (const _Kt & __x) ->
decltype(iterator(_M_t._M_lower_bound_tr(__x)))
[inline]
Finds the beginning of a subsequence matching given key.
__xβ key of (key, value) pair to be located.- Returns β iterator pointing to first element equal to or greater than key, or
end().
This function returns the first element of a subsequence of elements that matches the given key. If unsuccessful it returns an iterator pointing to the first element that has a greater value than given key or end() if no such element exists.
π lower_bound β the read-only transparent one π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Kt > auto std::multimap< _Key, _Tp, _Compare,
_Alloc >::lower_bound (const _Kt & __x) const ->
decltype(const_iterator(_M_t._M_lower_bound_tr(__x)))
[inline]
Finds the beginning of a subsequence matching given key. Same search, but nobody's allowed to poke the results π
__xβ key of (key, value) pair to be located.- Returns β read-only (constant) iterator pointing to first element equal to or greater than key, or
end().
This function returns the first element of a subsequence of elements that matches the given key. If unsuccessful the iterator will point to the next greatest element or, if no such greater element exists, to end().
okay bestie, we're back in the member function section and it's giving "finishing the list" energy β¨ no skipping, we're doing every single overload. let's go π
lower_bound (non-const) β first match, let's go π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::lower_bound (const key_type & __x) [inline]
okay so this one finds the beginning of a subsequence matching given key. like, the first element that's equal to or greater than key. it's giving "start of the equal range" energy.
Parameters:
__xβ Key of (key, value) pair to be located.
Returns:
- Iterator pointing to first element equal to or greater than key, or
end().
This function returns the first element of a subsequence of elements that matches the given key. If unsuccessful it returns an iterator pointing to the first element that has a greater value than given key or end() if no such element exists. no cap, that's the whole vibe. π
lower_bound (const) β same but read-only, slay π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::lower_bound (const key_type & __x) const [inline]
same deal: finds the beginning of a subsequence matching given key.
Parameters:
__xβ Key of (key, value) pair to be located.
Returns:
- Read-only (constant) iterator pointing to first element equal to or greater than key, or
end().
This function returns the first element of a subsequence of elements that matches the given key. If unsuccessful the iterator will point to the next greatest element or, if no such greater element exists, to end(). (so like, it's the const version, but the drama is the same.) π¦
max_size β the absolute limit, bestie π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> size_type std::multimap< _Key, _Tp, _Compare, _Alloc >::max_size
() const [inline], [noexcept]
Returns the maximum size of the multimap. that's it. that's the whole function. iconic. π
operator= (copy assignment) β default behavior, slay π«Ά
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> multimap & std::multimap< _Key, _Tp, _Compare, _Alloc
>::operator= (const multimap< _Key, _Tp, _Compare, _Alloc > &) [default]
Multimap assignment operator. Whether the allocator is copied depends on the allocator traits. (iykyk with allocator traits β it's giving "it depends" and we respect it.) π
operator= (initializer_list) β list assignment, periodt π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> multimap & std::multimap< _Key, _Tp, _Compare, _Alloc
>::operator= (initializer_list< value_type > __l) [inline]
Multimap list assignment operator.
Parameters:
__lβ An initializer_list.
This function fills a multimap with copies of the elements in the initializer list __l.
Note that the assignment completely changes the multimap and that the resulting multimap's size is the same as the number of elements assigned.
so like, it's a full glow-up, not a merge. the old contents are gone, bestie. π
operator= (move assignment) β default move, iconic π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> multimap & std::multimap< _Key, _Tp, _Compare, _Alloc
>::operator= (multimap< _Key, _Tp, _Compare, _Alloc > &&) [default]
Move assignment operator. short and sweet. no notes. π₯
rbegin (const) β reverse iterator, read-only π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_reverse_iterator std::multimap< _Key, _Tp, _Compare,
_Alloc >::rbegin () const [inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to the last pair in the multimap. Iteration is done in descending order according to the keys. so like, backwards vibes but still sorted. we love a consistent queen. πΈ
rbegin (non-const) β reverse iterator, read/write π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> reverse_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::rbegin () [inline], [noexcept]
Returns a read/write reverse iterator that points to the last pair in the multimap. Iteration is done in descending order according to the keys. same energy, but you can write through it. periodt. π
rend (const) β reverse end, read-only π¦
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_reverse_iterator std::multimap< _Key, _Tp, _Compare,
_Alloc >::rend () const [inline], [noexcept]
Returns a read-only (constant) reverse iterator that points to one before the first pair in the multimap. Iteration is done in descending order according to the keys. (yes, one before the first β that's the reverse end, bestie. it's not a bug, it's a feature.) π
rend (non-const) β reverse end, read/write π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> reverse_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::rend () [inline], [noexcept]
Returns a read/write reverse iterator that points to one before the first pair in the multimap. Iteration is done in descending order according to the keys. (same but mutable, go off.) π
size β how many pairs, fr fr π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> size_type std::multimap< _Key, _Tp, _Compare, _Alloc >::size ()
const [inline], [noexcept]
Returns the size of the multimap. simple. iconic. no cap. π
swap β trade places, no cap π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> void std::multimap< _Key, _Tp, _Compare, _Alloc >::swap
(multimap< _Key, _Tp, _Compare, _Alloc > & __x) [inline], [noexcept]
Swaps data with another multimap.
Parameters:
__xβ A multimap of the same element and allocator types.
This exchanges the elements between two multimaps in constant time. (It is only swapping a pointer, an integer, and an instance of the Compare type (which itself is often stateless and empty), so it should be quite fast.) Note that the global std::swap() function is specialized such that std::swap(m1,m2) will feed to this function.
Whether the allocators are swapped depends on the allocator traits. (again with the allocator traits β it's giving "ask your allocator" and we respect it.) π«Ά
upper_bound (template, non-const) β end of the match range π₯
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Kt > auto std::multimap< _Key, _Tp, _Compare,
_Alloc >::upper_bound (const _Kt & __x) ->
decltype(iterator(_M_t._M_upper_bound_tr(__x)))
[inline]"
Finds the end of a subsequence matching given key.
Parameters:
__xβ Key of (key, value) pair to be located.
Returns:
- Iterator pointing to the first element greater than key, or
end().
so like, it's the after-party of the equal range. the first element that's strictly greater than key. π
upper_bound (template, const) β end of the match range, read-only πΈ
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> template<typename _Kt > auto std::multimap< _Key, _Tp, _Compare,
_Alloc >::upper_bound (const _Kt & __x) const ->
decltype(const_iterator(_M_t._M_upper_bound_tr(__x)))
[inline]"
Finds the end of a subsequence matching given key.
Parameters:
__xβ Key of (key, value) pair to be located.
Returns:
- Read-only (constant) iterator pointing to first iterator greater than key, or
end().
same vibe, const iterator. it's giving "I can look but I can't touch." π
upper_bound (non-template, non-const) β end of the match range π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::upper_bound (const key_type & __x) [inline]
Finds the end of a subsequence matching given key.
Parameters:
__xβ Key of (key, value) pair to be located.
Returns:
- Iterator pointing to the first element greater than key, or
end().
okay so this is the non-template version, but the energy is the same: first element strictly greater than key. periodt. π₯
upper_bound (non-template, const) β end of the match range, read-only π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> const_iterator std::multimap< _Key, _Tp, _Compare, _Alloc
>::upper_bound (const key_type & __x) const [inline]
Finds the end of a subsequence matching given key.
Parameters:
__xβ Key of (key, value) pair to be located.
Returns:
- Read-only (constant) iterator pointing to first iterator greater than key, or
end().
const version, read-only iterator. same deal. we love consistency. π
value_comp β the comparison object π
template<typename _Key , typename _Tp , typename _Compare =
std::less<_Key>, typename _Alloc = std::allocator<std::pair<const _Key,
_Tp> >> value_compare std::multimap< _Key, _Tp, _Compare, _Alloc
>::value_comp () const [inline]
Returns a value comparison object, built from the key comparison object out of which the multimap was constructed. (it's giving "the compare function but for values" β no cap.) π§
Author
Generated automatically by Doxygen for libstdc++ from the source code. (yes bestie, even the docs are auto-generated β Doxygen ate.) π
big shoutout to libstdc++ and Doxygen for this page β the footer has the source/version vibe (libststd::multimap< ...mpare, _Alloc >(3cxx)) and the date is right there in the footer too, bestie. check it, mwah π
β¨π
π¦ where this page comes from
- ubuntu noble: libstdc++-14-doc 14-20240412-0ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms