Section

std::multiset

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.

# Declarations

template<
class Key,
class Compare = std::less<Key>,
class Allocator = std::allocator<Key>
> class multiset;
namespace pmr {
template<
class Key,
class Compare = std::less<Key>
> using multiset = std::multiset<Key, Compare, std::pmr::polymorphic_allocator<Key>>;
}

(since C++17)

# Notes

The member types iterator and const_iterator may be aliases to the same type. This means defining a pair of function overloads using the two types as parameter types may violate the One Definition Rule. Since iterator is convertible to const_iterator, a single function with a const_iterator as parameter type will work instead.

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
LWG 103C++98iterator allows modification of keysiterator made constant
LWG 230C++98Key was not required to be CopyConstructible(a key of type Key might not be able to be constructed)Key is also required tobe CopyConstructible

# See also