std::pair
cppreference.com
<tbody>
</tbody>
| <utility> 에 정의되어 있음.
|
||
template< class T1, class T2 > struct pair; |
||
std::pair는 두 개의 독립된 objects를 하나의 컨테이너에 저장하는 템플릿이다. std::tuple이 2개의 elements로 구성되는 경우와 동일하다.
Template parameters
| T1, T2 | - | the types of the elements that the pair stores. |
Member types
| Member type | Definition |
first_type
|
T1
|
second_type
|
T2
|
Member objects
| Member name | Type |
first
|
T1
|
second
|
T2
|
Member functions
| constructs new pair (public member function) | |
| assigns the contents (public member function) | |
(C++11) |
swaps the contents (public member function) |
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) |
accesses an element of a pair (function template) |
Helper classes
(C++11) |
obtains the size of a pair (class template specialization) |
obtains the type of the elements of pair (class template specialization) |
See also
(C++11) |
서로 다른 자료형의 원소를 저장할 수 있는 고정된 크기의 컨테이너를 구현 (class template) |