liveBook · Manning

Map

As explained in Object-Oriented Software Design in C++

A map is an associative data structure that stores key-value pairs and supports retrieving values by key.

A dictionary stores key–value pairs: each key identifies a value for retrieval. In C++, the STL map requires one key type and one value type, with keys sorted internally. section 2.3.4 section 11.1.2

A dictionary design can provide:

  • One reusable collection for book attributes instead of separate subclasses. section 2.3.4

Book attributes

An attribute dictionary can represent {KIND: fiction, TITLE: 'Carrie', LAST: 'King', FIRST: 'Stephen', YEAR: 1974, GENRE: horror}. Searching for KIND = fiction, LAST = KING, and GENRE = horror finds matching books.

How Object-Oriented Software Design in C++ covers it

How deep it goes
Defines key–value mapping and demonstrates typed implementation with map and variant, without detailing map internals.
Examples
Demonstrates book records, typed attribute tables, case-insensitive surname matching, and region-based cookbook searches.
What it assumes
Assumes basic C++ classes and enumerations while demonstrating map declarations, iteration, and typed value retrieval.
What you can do after
Apply it via STL map and variant to model heterogeneous attributes and query matching records.
How it connects
Connects dictionaries with key–value pairs, STL map, enumeration types, variant, and catalogue search.

Also explained in

Compare how 42 books explain Map →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Object-Oriented Software Design in C++. The section links point to the parts of the book it draws on.