std::pair
C++ allows us to pair values, which often comes in handy in programming.
We'll cover the following...
With std::pair
, we 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 are used in the C++ library. For example, the function std::minmax
returns its ...