C++ Language/Std/Stl/CollectionClasses/SortedCollections/PairAsOneItem

A "pair" is an object whose type encapsulates two other types.

A pair has a literal form, using braces: std::pair<char,int> ciVar = {'a',11};. Access each component as ciVar.first or ciVar.second.

Pair assignment (= operator) copies-by-value the two elements from source to destination. Usually, assignment's destination is another pair. However, pair-assignment could also use std::tie() to decompose into two scalar variables.

Additional information about std::pair (includes interactive examples)