- To use any of
std::multimapthe header file
<map>should be included.
std::multimapboth keep their elements sorted according to the ascending order of keys. In case of
std::multimap, no sorting occurs for the values of the same key.
- The basic difference between
std::multimapis that the
std::mapone does not allow duplicate values for the same key where
- Maps are implemented as binary search trees. So
erase()takes Θ(log n) time in average. For constant time operation use
empty()functions have Θ(1) time complexity, number of nodes is cached to avoid walking through tree each time these functions are called.
Table Of Contents