Scroll to navigation

std::pair< _T1, _T2 >(3) Library Functions Manual std::pair< _T1, _T2 >(3)

NAME

std::pair< _T1, _T2 > - Struct holding two objects of arbitrary type.

SYNOPSIS

Inherits std::__pair_base< _U1, _U2 >.

Public Types


template<typename _U1 , typename _U2 > using _PCCFP = _PCC<!is_same< _T1, _U1 >::value||!is_same< _T2, _U2 >::value, _T1, _T2 >
using _PCCP = _PCC< true, _T1, _T2 >
typedef _T1 first_type
typedef _T2 second_type
first_type is the first bound type

Public Member Functions


template<typename _U1 = _T1, typename _U2 = _T2, typename enable_if< __and_< __is_implicitly_default_constructible< _U1 >, __is_implicitly_default_constructible< _U2 >> ::value, bool >::type = true> constexpr pair ()
second is a copy of the second object template<typename _U1 = _T1, typename _U2 = _T2, typename enable_if< _PCCP::template _ConstructiblePair< _U1, _U2 >() &&_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr pair (const _T1 &__a, const _T2 &__b)
template<typename _U1 = _T1, typename _U2 = _T2, typename enable_if< _PCCP::template _ConstructiblePair< _U1, _U2 >() &&!_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr pair (const _T1 &__a, const _T2 &__b)
template<typename _U1 , typename _U2 , typename enable_if< _PCCFP< _U1, _U2 >::template _ConstructiblePair< _U1, _U2 >() &&_PCCFP< _U1, _U2 >::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr pair (const pair< _U1, _U2 > &__p)
template<typename _U1 , typename _U2 , typename enable_if< _PCCFP< _U1, _U2 >::template _ConstructiblePair< _U1, _U2 >() &&!_PCCFP< _U1, _U2 >::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr pair (const pair< _U1, _U2 > &__p)
constexpr pair (const pair &)=default
constexpr pair (pair &&)=default
template<typename _U1 , typename enable_if< _PCCP::template _MoveCopyPair< true, _U1, _T2 >(), bool >::type = true> constexpr pair (_U1 &&__x, const _T2 &__y)
template<typename _U1 , typename enable_if< _PCCP::template _MoveCopyPair< false, _U1, _T2 >(), bool >::type = false> constexpr pair (_U1 &&__x, const _T2 &__y)
template<typename _U2 , typename enable_if< _PCCP::template _CopyMovePair< true, _T1, _U2 >(), bool >::type = true> constexpr pair (const _T1 &__x, _U2 &&__y)
template<typename _U2 , typename enable_if< _PCCP::template _CopyMovePair< false, _T1, _U2 >(), bool >::type = false> pair (const _T1 &__x, _U2 &&__y)
template<typename _U1 , typename _U2 , typename enable_if< _PCCP::template _MoveConstructiblePair< _U1, _U2 >() &&_PCCP::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr pair (_U1 &&__x, _U2 &&__y)
template<typename _U1 , typename _U2 , typename enable_if< _PCCP::template _MoveConstructiblePair< _U1, _U2 >() &&!_PCCP::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr pair (_U1 &&__x, _U2 &&__y)
template<typename _U1 , typename _U2 , typename enable_if< _PCCFP< _U1, _U2 >::template _MoveConstructiblePair< _U1, _U2 >() &&_PCCFP< _U1, _U2 >::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = true> constexpr pair (pair< _U1, _U2 > &&__p)
template<typename _U1 , typename _U2 , typename enable_if< _PCCFP< _U1, _U2 >::template _MoveConstructiblePair< _U1, _U2 >() &&!_PCCFP< _U1, _U2 >::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = false> constexpr pair (pair< _U1, _U2 > &&__p)
template<typename... _Args1, typename... _Args2> pair (piecewise_construct_t, tuple< _Args1... >, tuple< _Args2... >)
pair & operator= (typename conditional< __and_< is_copy_assignable< _T1 >, is_copy_assignable< _T2 >>::value, const pair &, const __nonesuch_no_braces &>::type __p)
pair & operator= (typename conditional< __and_< is_move_assignable< _T1 >, is_move_assignable< _T2 >>::value, pair &&, __nonesuch_no_braces &&>::type __p) noexcept(__and_< is_nothrow_move_assignable< _T1 >, is_nothrow_move_assignable< _T2 >>::value)
template<typename _U1 , typename _U2 > enable_if< __and_< is_assignable< _T1 &, const _U1 & >, is_assignable< _T2 &, const _U2 & > >::value, pair & >::type operator= (const pair< _U1, _U2 > &__p)
template<typename _U1 , typename _U2 > enable_if< __and_< is_assignable< _T1 &, _U1 && >, is_assignable< _T2 &, _U2 && > >::value, pair & >::type operator= (pair< _U1, _U2 > &&__p)
void swap (pair &__p) noexcept(__and_< __is_nothrow_swappable< _T1 >, __is_nothrow_swappable< _T2 >>::value)

Public Attributes


_T1 first
second_type is the second bound type _T2 second
first is a copy of the first object

Detailed Description

template<typename _T1, typename _T2>

struct std::pair< _T1, _T2 >" Struct holding two objects of arbitrary type.

Template Parameters:

_T1 Type of first object.
_T2 Type of second object.

Definition at line 208 of file stl_pair.h.

Member Typedef Documentation

template<typename _T1, typename _T2> template<typename _U1 , typename _U2 > using std::pair< _T1, _T2 >::_PCCFP = _PCC<!is_same<_T1, _U1>::value || !is_same<_T2, _U2>::value, _T1, _T2>

There is also a templated copy ctor for the pair class itself.

Definition at line 283 of file stl_pair.h.

template<typename _T1, typename _T2> using std::pair< _T1, _T2 >::_PCCP = _PCC<true, _T1, _T2>

Two objects may be passed to a pair constructor to be copied.

Definition at line 252 of file stl_pair.h.

template<typename _T1, typename _T2> typedef _T2 std::pair< _T1, _T2 >::second_type

first_type is the first bound type

Definition at line 212 of file stl_pair.h.

Constructor & Destructor Documentation

template<typename _T1, typename _T2> template<typename _U1 = _T1, typename _U2 = _T2, typename enable_if< __and_< __is_implicitly_default_constructible< _U1 >, __is_implicitly_default_constructible< _U2 >> ::value, bool >::type = true> constexpr std::pair< _T1, _T2 >::pair () [inline]

second is a copy of the second object The default constructor creates first and second using their respective default constructors.

Definition at line 229 of file stl_pair.h.

Member Data Documentation

template<typename _T1, typename _T2> _T1 std::pair< _T1, _T2 >::first

second_type is the second bound type

Definition at line 214 of file stl_pair.h.

Referenced by std::__sample(), __gnu_debug::__valid_range_aux(), std::set< _Key, _Compare, _Alloc >::insert(), std::operator<(), std::operator==(), and std::regex_replace().

template<typename _T1, typename _T2> _T2 std::pair< _T1, _T2 >::second

first is a copy of the first object

Definition at line 215 of file stl_pair.h.

Referenced by std::__sample(), __gnu_debug::__valid_range_aux(), std::set< _Key, _Compare, _Alloc >::insert(), std::operator==(), and std::regex_replace().

Author

Generated automatically by Doxygen for libstdc++ from the source code.

Fri May 24 2024 libstdc++