Introduction

After sequential containers, let's enter the world of associative containers and learn about the principle of key/value pairs.

We'll cover the following...

C++ has eight different associative containers. Four of them are associative containers with sorted keys: std::set, std::map, std::multiset and std::multimap. The other four are associative containers with unsorted keys: std::unordered_set, std::unordered_map, std::unordered_multiset and std::unordered_multimap. The associative containers are special containers. That means they support all of the operations described in the chapter Interface of all containers.

Overview

All eight ordered and unordered containers have in common that they associate a key with a value. You can use the key to get the value. To get a classification of the associative containers, three simple questions need to be answered: ...