Section

std::multimap

std::multimap is an associative container that contains a sorted list of key-value pairs, while permitting multiple entries with the same key. Sorting is done according to the comparison function Compare, applied to the keys. Search, insertion, and removal operations have logarithmic complexity.

# Declarations

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

(since C++17)

# Notes

Feature-test macro Value Std Feature __cpp_lib_containers_ranges 202202L (C++23) Ranges construction and insertion for containers

# Defect reports

DRApplied toBehavior as publishedCorrect behavior
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