std::pair
From Cppreference
| C++ Standard Library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Utilities library | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::pair | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Defined in header <utility>
|
||
| template<
class T1, |
||
std::pair is a struct template that provides a way to store two heterogeneous objects as a single unit.
Contents |
[edit] Member types
| Member type | Definition |
first_type
|
T1
|
second_type
|
T2
|
[edit] Member objects
| Member name | Type |
first
|
T1
|
second
|
T2
|
[edit] Member functions
| constructs new pair (public member function) |
|
| assigns the contents (public member function) |
|
| (C++11)
|
swaps the contents (public member function) |
[edit] Non-member functions
| 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)
|
(function template) |
[edit] Helper classes
| (C++11)
|
obtains the size of a pair (class template specialization) |
| (C++11)
|
obtains the type of the elements of pair (class template specialization) |