Lesson 20. STL Map Classes

The Standard Template Library (STL) supplies the programmer with container classes that help with applications that require frequent and quick searches.

This lesson covers

• How STL map and multimap, unordered_map and unordered_multimap containers can be of use to you

• Insertion, removal, and search of elements

• Supplying a custom sort predicate

• Basics of how hash tables work

An Introduction to STL Map Classes

The map and multimap are key-value pair containers that allow for a lookup on the basis of a key as shown in Figure 20.1.

Image

Figure 20.1. Visual illustration of a container for pairs, each holding a key and a ...

Get Sams Teach Yourself C++ in One Hour a Day, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.