liveBook · Manning

Name-value pair

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

A name-value pair is a data association in which an identifying name or key corresponds to a value.

A name–value pair associates an identifying key with its corresponding value. An STL map stores these pairs, using the key to retrieve the value; all keys share one datatype, while values may use another. section 2.3.4

Searching by associated attributes

A catalogue query can request {KIND: fiction, LAST: 'KING', GENRE: horror}; matching pairs find Carrie and It: A Novel even when other attributes differ.

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

How deep it goes
Explains map key and value typing, then implements heterogeneous values with variant and pair matching.
Examples
Demonstrates book attribute maps, typed keys, catalogue queries, and matching results for fiction and regional cookbooks.
What you can do after
Build flexible C++ attribute storage and search using map, enum class, and variant.
How it connects
Connects maps with enumeration, variant, attributes, catalogue search, and encapsulation.

Also explained in

Compare how 11 books explain name-value pair →

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.