Overview

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

The ordered associative container 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 shows this very nicely.

Get hands-on with 1000+ tech skills courses.