Overview

Let's start our discussion on ordered associative containers by defining some simple characteristics.

fThe ordered associative containers std::map and std::multimap associate their key with a value. Both are defined in the header <map>. std::set and std::multiset need the header <set>.

All four ordered containers are parametrized by their type, their allocator, and their comparison function. The containers have default values for the allocator and the comparison function, depending on the type. The declaration of std::map and std::set show this very nicely.

Get hands-on with 1200+ tech skills courses.