.TH "std::pair< _T1, _T2 >" 3cxx "Tue Jun 13 2023" "libstdc++" \" -*- nroff -*- .ad l .nh .SH NAME std::pair< _T1, _T2 > \- Struct holding two objects of arbitrary type\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits __pair_base< _T1, _T2 >\&. .SS "Public Types" .in +1c .ti -1c .RI "typedef _T1 \fBfirst_type\fP" .br .RI "The type of the \fCfirst\fP member\&. " .ti -1c .RI "typedef _T2 \fBsecond_type\fP" .br .RI "The type of the \fCsecond\fP member\&. " .in -1c .SS "Public Member Functions" .in +1c .ti -1c .RI "template, __is_implicitly_default_constructible< _U2 > > ::value, bool >::type = true> constexpr \fBpair\fP ()" .br .ti -1c .RI "template, __not_< \fBis_reference\fP< _U2 > >, \fBis_constructible\fP< _T2, _U2 >, __not_< \fBis_constructible\fP< _T2, const _U2 & > >, \fBis_convertible\fP< _U2, _T2 > >::value, bool > = true> constexpr \fBpair\fP (__zero_as_null_pointer_constant, _U2 &&__y,\&.\&.\&.)" .br .ti -1c .RI "template, __not_< \fBis_reference\fP< _U2 > >, \fBis_constructible\fP< _T2, _U2 >, __not_< \fBis_constructible\fP< _T2, const _U2 & > >, __not_< \fBis_convertible\fP< _U2, _T2 > > >::value, bool > = false> constexpr \fBpair\fP (__zero_as_null_pointer_constant, _U2 &&__y,\&.\&.\&.)" .br .ti -1c .RI "template >, \fBis_pointer\fP< _T2 >, \fBis_constructible\fP< _T1, _U1 >, __not_< \fBis_constructible\fP< _T1, const _U1 & > >, \fBis_convertible\fP< _U1, _T1 > >::value, bool > = true> constexpr \fBpair\fP (_U1 &&__x, __zero_as_null_pointer_constant,\&.\&.\&.)" .br .ti -1c .RI "template >, \fBis_pointer\fP< _T2 >, \fBis_constructible\fP< _T1, _U1 >, __not_< \fBis_constructible\fP< _T1, const _U1 & > >, __not_< \fBis_convertible\fP< _U1, _T1 > > >::value, bool > = false> constexpr \fBpair\fP (_U1 &&__x, __zero_as_null_pointer_constant,\&.\&.\&.)" .br .ti -1c .RI "template() &&_PCCP::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr \fBpair\fP (_U1 &&__x, _U2 &&__y)" .br .ti -1c .RI "template() &&!_PCCP::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr \fBpair\fP (_U1 &&__x, _U2 &&__y)" .br .ti -1c .RI "template() &&_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr \fBpair\fP (const _T1 &__a, const _T2 &__b)" .br .RI "Construct from two const lvalues, allowing implicit conversions\&. " .ti -1c .RI "template() &&!_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr \fBpair\fP (const _T1 &__a, const _T2 &__b)" .br .RI "Construct from two const lvalues, disallowing implicit conversions\&. " .ti -1c .RI "constexpr \fBpair\fP (const \fBpair\fP &)=default" .br .RI "Copy constructor\&. " .ti -1c .RI "template::template _ConstructiblePair< _U1, _U2 >() &&_PCCFP< _U1, _U2 >::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr \fBpair\fP (const \fBpair\fP< _U1, _U2 > &__p)" .br .ti -1c .RI "template::template _ConstructiblePair< _U1, _U2 >() &&!_PCCFP< _U1, _U2 >::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr \fBpair\fP (const \fBpair\fP< _U1, _U2 > &__p)" .br .ti -1c .RI "constexpr \fBpair\fP (\fBpair\fP &&)=default" .br .RI "Move constructor\&. " .ti -1c .RI "template::template _MoveConstructiblePair< _U1, _U2 >() &&_PCCFP< _U1, _U2 >::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr \fBpair\fP (\fBpair\fP< _U1, _U2 > &&__p)" .br .ti -1c .RI "template::template _MoveConstructiblePair< _U1, _U2 >() &&!_PCCFP< _U1, _U2 >::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr \fBpair\fP (\fBpair\fP< _U1, _U2 > &&__p)" .br .ti -1c .RI "template constexpr \fBpair\fP (\fBpiecewise_construct_t\fP, \fBtuple\fP< _Args1\&.\&.\&. >, \fBtuple\fP< _Args2\&.\&.\&. >)" .br .ti -1c .RI "\fBpair\fP & \fBoperator=\fP (__conditional_t< __and_< \fBis_copy_assignable\fP< _T1 >, \fBis_copy_assignable\fP< _T2 > >::value, const \fBpair\fP &, const __nonesuch & > __p)" .br .ti -1c .RI "\fBpair\fP & \fBoperator=\fP (__conditional_t< __and_< \fBis_move_assignable\fP< _T1 >, \fBis_move_assignable\fP< _T2 > >::value, \fBpair\fP &&, __nonesuch && > __p) noexcept(__and_< \fBis_nothrow_move_assignable\fP< _T1 >, \fBis_nothrow_move_assignable\fP< _T2 > >::value)" .br .ti -1c .RI "template \fBenable_if\fP< __and_< \fBis_assignable\fP< _T1 &, const_U1 & >, \fBis_assignable\fP< _T2 &, const_U2 & > >::value, \fBpair\fP & >::type \fBoperator=\fP (const \fBpair\fP< _U1, _U2 > &__p)" .br .ti -1c .RI "template \fBenable_if\fP< __and_< \fBis_assignable\fP< _T1 &, _U1 && >, \fBis_assignable\fP< _T2 &, _U2 && > >::value, \fBpair\fP & >::type \fBoperator=\fP (\fBpair\fP< _U1, _U2 > &&__p)" .br .ti -1c .RI "constexpr void \fBswap\fP (\fBpair\fP &__p) noexcept(__and_< __is_nothrow_swappable< _T1 >, __is_nothrow_swappable< _T2 > >::value)" .br .RI "Swap the first members and then the second members\&. " .in -1c .SS "Public Attributes" .in +1c .ti -1c .RI "_T1 \fBfirst\fP" .br .RI "The first member\&. " .ti -1c .RI "_T2 \fBsecond\fP" .br .RI "The second member\&. " .in -1c .SS "Related Functions" (Note that these are not member functions\&.) .in +1c .ti -1c .RI "template constexpr \fBpair\fP< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > \fBmake_pair\fP (_T1 &&__x, _T2 &&__y)" .br .RI "A convenience wrapper for creating a pair from two objects\&. " .in -1c .PP .RI "\fB\fP" .br .in +1c .in +1c .ti -1c .RI "template \fBpair\fP (_T1, _T2) \-> \fBpair\fP< _T1, _T2 >" .br .RI "Two pairs of the same type are equal iff their members are equal\&. " .ti -1c .RI "template constexpr bool \fBoperator==\fP (const \fBpair\fP< _T1, _T2 > &__x, const \fBpair\fP< _T1, _T2 > &__y)" .br .RI "Two pairs of the same type are equal iff their members are equal\&. " .ti -1c .RI "template constexpr bool \fBoperator<\fP (const \fBpair\fP< _T1, _T2 > &__x, const \fBpair\fP< _T1, _T2 > &__y)" .br .ti -1c .RI "template constexpr bool \fBoperator!=\fP (const \fBpair\fP< _T1, _T2 > &__x, const \fBpair\fP< _T1, _T2 > &__y)" .br .RI "Uses \fCoperator==\fP to find the result\&. " .ti -1c .RI "template constexpr bool \fBoperator>\fP (const \fBpair\fP< _T1, _T2 > &__x, const \fBpair\fP< _T1, _T2 > &__y)" .br .RI "Uses \fCoperator<\fP to find the result\&. " .ti -1c .RI "template constexpr bool \fBoperator<=\fP (const \fBpair\fP< _T1, _T2 > &__x, const \fBpair\fP< _T1, _T2 > &__y)" .br .RI "Uses \fCoperator<\fP to find the result\&. " .ti -1c .RI "template constexpr bool \fBoperator>=\fP (const \fBpair\fP< _T1, _T2 > &__x, const \fBpair\fP< _T1, _T2 > &__y)" .br .RI "Uses \fCoperator<\fP to find the result\&. " .ti -1c .RI "template constexpr \fBenable_if\fP< __and_< __is_swappable< _T1 >, __is_swappable< _T2 > >::value >::type \fBswap\fP (\fBpair\fP< _T1, _T2 > &__x, \fBpair\fP< _T1, _T2 > &__y) noexcept(noexcept(__x\&.swap(__y)))" .br .in -1c .in -1c .SH "Detailed Description" .PP .SS "template .br struct std::pair< _T1, _T2 >"Struct holding two objects of arbitrary type\&. .PP \fBTemplate Parameters\fP .RS 4 \fI_T1\fP Type of first object\&. .br \fI_T2\fP Type of second object\&. .RE .PP https://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html .SH "Member Typedef Documentation" .PP .SS "template typedef _T1 \fBstd::pair\fP< _T1, _T2 >::first_type" .PP The type of the \fCfirst\fP member\&. .SS "template typedef _T2 \fBstd::pair\fP< _T1, _T2 >::second_type" .PP The type of the \fCsecond\fP member\&. .SH "Constructor & Destructor Documentation" .PP .SS "template constexpr \fBstd::pair\fP< _T1, _T2 >::pair (const \fBpair\fP< _T1, _T2 > &)\fC [constexpr]\fP, \fC [default]\fP" .PP Copy constructor\&. .SS "template constexpr \fBstd::pair\fP< _T1, _T2 >::pair (\fBpair\fP< _T1, _T2 > &&)\fC [constexpr]\fP, \fC [default]\fP" .PP Move constructor\&. .SS "template template, __is_implicitly_default_constructible< _U2 > > ::value, bool >::type = true> constexpr \fBstd::pair\fP< _T1, _T2 >::pair ()\fC [inline]\fP, \fC [constexpr]\fP" The default constructor creates \fCfirst\fP and \fCsecond\fP using their respective default constructors\&. .br .SS "template template() &&_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr \fBstd::pair\fP< _T1, _T2 >::pair (const _T1 & __a, const _T2 & __b)\fC [inline]\fP, \fC [constexpr]\fP" .PP Construct from two const lvalues, allowing implicit conversions\&. .SS "template template() &&!_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr \fBstd::pair\fP< _T1, _T2 >::pair (const _T1 & __a, const _T2 & __b)\fC [inline]\fP, \fC [explicit]\fP, \fC [constexpr]\fP" .PP Construct from two const lvalues, disallowing implicit conversions\&. .SH "Member Function Documentation" .PP .SS "template constexpr void \fBstd::pair\fP< _T1, _T2 >::swap (\fBpair\fP< _T1, _T2 > & __p)\fC [inline]\fP, \fC [constexpr]\fP, \fC [noexcept]\fP" .PP Swap the first members and then the second members\&. .PP References \fBstd::pair< _T1, _T2 >::first\fP, \fBstd::pair< _T1, _T2 >::second\fP, \fBstd::swap()\fP, and \fBstd::pair< _T1, _T2 >::swap()\fP\&. .PP Referenced by \fBstd::swap()\fP, \fBstd::pair< _T1, _T2 >::swap()\fP, and \fBstd::sub_match< _BiIter >::swap()\fP\&. .SH "Member Data Documentation" .PP .SS "template _T1 \fBstd::pair\fP< _T1, _T2 >::first" .PP The first member\&. .PP Referenced by \fBstd::_Temporary_buffer< _ForwardIterator, _Tp >::_Temporary_buffer()\fP, \fB__gnu_parallel::__find_template()\fP, \fBstd::__sample()\fP, \fBstd::set< _Key, _Compare, _Alloc >::insert()\fP, \fBstd::pair< _T1, _T2 >::operator<()\fP, \fBstd::pair< _T1, _T2 >::operator==()\fP, and \fBstd::pair< _T1, _T2 >::swap()\fP\&. .SS "template _T2 \fBstd::pair\fP< _T1, _T2 >::second" .PP The second member\&. .PP Referenced by \fBstd::__sample()\fP, \fBstd::set< _Key, _Compare, _Alloc >::insert()\fP, \fBstd::pair< _T1, _T2 >::operator<()\fP, \fBstd::pair< _T1, _T2 >::operator==()\fP, and \fBstd::pair< _T1, _T2 >::swap()\fP\&. .SH "Author" .PP Generated automatically by Doxygen for libstdc++ from the source code\&.