std::multiset (3) - Linux Manuals
std::multiset: std::multiset
NAME
Synopsis
Defined in header <set>
template<
class Key,
class Compare = std::less<Key>, (1)
class Allocator = std::allocator<Key>
> class multiset;
namespace pmr {
template <class Key, class Compare = std::less<Key>>
using multiset = std::multiset<Key, Compare, (2) (since C++17)
std::pmr::polymorphic_allocator<Key>>;
}
std::multiset is an associative container that contains a sorted set of objects of type Key. Unlike set, multiple keys with equivalent values are allowed. Sorting is done using the key comparison function Compare. Search, insertion, and removal operations have logarithmic complexity.
Everywhere the standard library uses the Compare requirements, equivalence is determined by using the equivalence relation as described on Compare. In imprecise terms, two objects a and b are considered equivalent if neither compares less than the other: !comp(a, b) && !comp(b, a).
The order of the elements that compare equivalent is the order of insertion and does not change. (since C++11)
std::multiset meets the requirements of Container, AllocatorAwareContainer, AssociativeContainer and ReversibleContainer.
Member types
Member type Definition
key_type Key
value_type Key
size_type Unsigned integer type (usually std::size_t)
difference_type Signed integer type (usually std::ptrdiff_t)
key_compare Compare
value_compare Compare
allocator_type Allocator
reference Allocator::reference (until C++11)
const_reference Allocator::const_reference (until C++11)
pointer Allocator::pointer (until C++11)
const_pointer Allocator::const_pointer (until C++11)
iterator Constant LegacyBidirectionalIterator
const_iterator Constant LegacyBidirectionalIterator
reverse_iterator std::reverse_iterator<iterator>
const_reverse_iterator std::reverse_iterator<const_iterator>
node_type(since C++17) a specialization of node_handle representing a container node
Member functions
constructor (public member function)
destructor (public member function)
operator= (public member function)
get_allocator (public member function)
Iterators
begin returns an iterator to the beginning
cbegin (public member function)
end_ returns an iterator to the end
cend (public member function)
rbegin returns a reverse iterator to the beginning
crbegin (public member function)
rend returns a reverse iterator to the end
crend (public member function)
Capacity
empty (public member function)
size (public member function)
max_size (public member function)
Modifiers
clear (public member function)
insert (since C++17)
emplace constructs element in-place
(C++11)