CARVIEW |
Select Language
HTTP/1.1 200 OK
Server: nginx
Date: Sat, 19 Jul 2025 18:40:18 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
ETag: W/"7170-bOj5k050735kS4CR0RDU2c2crxQ"
Content-Encoding: gzip
This class couples together a pair of values, which may be of different types (T1 and T2). The individual values can be accessed through its public members first and second.
Pairs are a particular case of tuple.
Reference
C library:
- <cassert> (assert.h)
- <cctype> (ctype.h)
- <cerrno> (errno.h)
-
<cfenv> (fenv.h)C++11
- <cfloat> (float.h)
-
<cinttypes> (inttypes.h)C++11
- <ciso646> (iso646.h)
- <climits> (limits.h)
- <clocale> (locale.h)
- <cmath> (math.h)
- <csetjmp> (setjmp.h)
- <csignal> (signal.h)
- <cstdarg> (stdarg.h)
-
<cstdbool> (stdbool.h)C++11
- <cstddef> (stddef.h)
-
<cstdint> (stdint.h)C++11
- <cstdio> (stdio.h)
- <cstdlib> (stdlib.h)
- <cstring> (string.h)
-
<ctgmath> (tgmath.h)C++11
- <ctime> (time.h)
-
<cuchar> (uchar.h)C++11
- <cwchar> (wchar.h)
- <cwctype> (wctype.h)
Containers:
-
<array>C++11
- <deque>
-
<forward_list>C++11
- <list>
- <map>
- <queue>
- <set>
- <stack>
-
<unordered_map>C++11
-
<unordered_set>C++11
- <vector>
-
Input/Output:
Multi-threading:
-
<atomic>C++11
-
<condition_variable>C++11
-
<future>C++11
-
<mutex>C++11
-
<thread>C++11
-
Other:
- <algorithm>
- <bitset>
-
<chrono>C++11
-
<codecvt>C++11
- <complex>
- <exception>
- <functional>
-
<initializer_list>C++11
- <iterator>
- <limits>
- <locale>
- <memory>
- <new>
- <numeric>
-
<random>C++11
-
<ratio>C++11
-
<regex>C++11
- <stdexcept>
- <string>
-
<system_error>C++11
-
<tuple>C++11
-
<type_traits>C++11
-
<typeindex>C++11
- <typeinfo>
- <utility>
- <valarray>
<utility>
classes
functions
types
-
piecewise_construct_tC++11
-
constants
-
piecewise_constructC++11
-
namespaces
pair
- pair::pair
member functions
- pair::operator=
-
pair::swapC++11
non-member overloads
-
get (pair)C++11
- relational operators (pair)
-
swap (pair)C++11
-
non-member specializations
-
tuple_element<pair>C++11
-
tuple_size<pair>C++11
-
class template
<utility>
std::pair
template <class T1, class T2> struct pair;
Pair of values
Pairs are a particular case of tuple.
Template parameters
- T1
- Type of member first, aliased as first_type.
- T2
- Type of member second, aliased as second_type.
Member types
member type | definition | notes |
---|---|---|
first_type | The first template parameter (T1) | Type of member first. |
second_type | The second template parameter (T2) | Type of member second. |
Member variables
member variable | definition |
---|---|
first | The first value in the pair |
second | The second value in the pair |
Member functions
- (constructor)
- Construct pair (public member function)
- pair::operator=
- Assign contents (public member function)
- pair::swap
- Swap contents (public member function)
Non-member function overloads
- relational operators (pair)
- Relational operators for pair (function template)
- swap (pair)
- Exchanges the contents of two pairs (function template)
- get (pair)
- Get element (tuple interface) (function template)
Non-member class specializations
- tuple_element<pair>
- Tuple element type for pair (class template specialization)
- tuple_size<pair>
- Tuple traits for pair (class template specialization)
See also
- make_pair
- Construct pair object (function template)
- piecewise_construct
- Piecewise construct constant (constant)
Home page | Privacy policy
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us
© cplusplus.com, 2000-2025 - All rights reserved - v3.3.4s
Spotted an error? contact us