Defined in header <utility> | ||
---|---|---|
template< class T1, class T2 > struct pair; |
std::pair
is a struct template that provides a way to store two heterogeneous objects as a single unit. A pair is a specific case of a std::tuple
with two elements.
If | (since C++17) |
T1, T2 | - | the types of the elements that the pair stores. |
Member type | Definition |
---|---|
first_type | T1 |
second_type | T2 |
Member name | Type |
---|---|
first | T1 |
second | T2 |
constructs new pair (public member function) |
|
assigns the contents (public member function) |
|
(C++11) | swaps the contents (public member function) |
creates a pair object of type, defined by the argument types (function template) |
|
lexicographically compares the values in the pair (function template) |
|
(C++11) | specializes the std::swap algorithm (function template) |
(C++11) | accesses an element of a pair (function template) |
(C++11) | obtains the size of a pair (class template specialization) |
(C++11) | obtains the type of the elements of pair (class template specialization) |
(C++11) | implements fixed size container, which holds elements of possibly different types (class template) |
creates a tuple of lvalue references or unpacks a tuple into individual objects (function template) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
http://en.cppreference.com/w/cpp/utility/pair