...

/

Pairs

Pairs

The idea of a pair of values often comes handy in programming. C++ allows us to make these pairs.

With std::pair, you can build pairs of arbitrary types. The class template std::pair needs the header <utility>. std::pair has a default, copy and move constructor. Pair objects can be swapped: std::swap(pair1, pair2).

Pairs will often be used in the ...