libstdc++
std::pair< _T1, _T2 > Struct Template Reference

#include <stl_pair.h>

Inheritance diagram for std::pair< _T1, _T2 >:
[legend]

Public Types

typedef _T1 first_type
 
typedef _T2 second_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 ()
 
template<typename _U2 , __enable_if_t< __and_< is_pointer< _T1 >, __not_< is_reference< _U2 > >, is_constructible< _T2, _U2 >, __not_< is_constructible< _T2, const _U2 & > >, is_convertible< _U2, _T2 > >::value, bool > = true>
constexpr pair (__zero_as_null_pointer_constant, _U2 &&__y,...)
 
template<typename _U2 , __enable_if_t< __and_< is_pointer< _T1 >, __not_< is_reference< _U2 > >, is_constructible< _T2, _U2 >, __not_< is_constructible< _T2, const _U2 & > >, __not_< is_convertible< _U2, _T2 > > >::value, bool > = false>
constexpr pair (__zero_as_null_pointer_constant, _U2 &&__y,...)
 
template<typename _U1 , __enable_if_t< __and_< __not_< is_reference< _U1 > >, is_pointer< _T2 >, is_constructible< _T1, _U1 >, __not_< is_constructible< _T1, const _U1 & > >, is_convertible< _U1, _T1 > >::value, bool > = true>
constexpr pair (_U1 &&__x, __zero_as_null_pointer_constant,...)
 
template<typename _U1 , __enable_if_t< __and_< __not_< is_reference< _U1 > >, is_pointer< _T2 >, is_constructible< _T1, _U1 >, __not_< is_constructible< _T1, const _U1 & > >, __not_< is_convertible< _U1, _T1 > > >::value, bool > = false>
constexpr pair (_U1 &&__x, __zero_as_null_pointer_constant,...)
 
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 = _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)
 
constexpr pair (const pair &)=default
 
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 (pair &&)=default
 
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>
constexpr pair (piecewise_construct_t, tuple< _Args1... >, tuple< _Args2... >)
 
pairoperator= (__conditional_t< __and_< is_copy_assignable< _T1 >, is_copy_assignable< _T2 > >::value, const pair &, const __nonesuch & > __p)
 
pairoperator= (__conditional_t< __and_< is_move_assignable< _T1 >, is_move_assignable< _T2 > >::value, pair &&, __nonesuch && > __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)
 
constexpr void swap (pair &__p) noexcept(__and_< __is_nothrow_swappable< _T1 >, __is_nothrow_swappable< _T2 > >::value)
 

Public Attributes

_T1 first
 
_T2 second
 

Related Symbols

(Note that these are not member symbols.)

template<typename _T1 , typename _T2 >
constexpr pair< typename __decay_and_strip< _T1 >::__type, typename __decay_and_strip< _T2 >::__type > make_pair (_T1 &&__x, _T2 &&__y)
 
template<typename _T1 , typename _T2 >
 pair (_T1, _T2) -> pair< _T1, _T2 >
 
template<typename _T1 , typename _T2 >
constexpr bool operator== (const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
 
template<typename _T1 , typename _T2 >
constexpr bool operator< (const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
 
template<typename _T1 , typename _T2 >
constexpr bool operator!= (const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
 
template<typename _T1 , typename _T2 >
constexpr bool operator> (const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
 
template<typename _T1 , typename _T2 >
constexpr bool operator<= (const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
 
template<typename _T1 , typename _T2 >
constexpr bool operator>= (const pair< _T1, _T2 > &__x, const pair< _T1, _T2 > &__y)
 
template<typename _T1 , typename _T2 >
constexpr enable_if< __and_< __is_swappable< _T1 >, __is_swappable< _T2 > >::value >::type swap (pair< _T1, _T2 > &__x, pair< _T1, _T2 > &__y) noexcept(noexcept(__x.swap(__y)))
 

Detailed Description

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

Struct holding two objects of arbitrary type.

Template Parameters
_T1Type of first object.
_T2Type of second object.

https://gcc.gnu.org/onlinedocs/libstdc++/manual/utilities.html

Definition at line 185 of file stl_pair.h.

Member Typedef Documentation

◆ first_type

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

The type of the first member.

Definition at line 188 of file stl_pair.h.

◆ second_type

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

The type of the second member.

Definition at line 189 of file stl_pair.h.

Constructor & Destructor Documentation

◆ pair() [1/16]

template<typename _T1 , typename _T2 >
constexpr std::pair< _T1, _T2 >::pair ( const pair< _T1, _T2 > &  )
constexprdefault

Copy constructor.

◆ pair() [2/16]

template<typename _T1 , typename _T2 >
constexpr std::pair< _T1, _T2 >::pair ( pair< _T1, _T2 > &&  )
constexprdefault

Move constructor.

◆ pair() [3/16]

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 ( )
inlineconstexpr

The default constructor creates first and second using their respective default constructors.

Definition at line 384 of file stl_pair.h.

◆ pair() [4/16]

template<typename _T1 , typename _T2 >
template<typename _U1 = _T1, typename _U2 = _T2, typename enable_if< __and_< is_default_constructible< _U1 >, is_default_constructible< _U2 >, __not_< __and_< __is_implicitly_default_constructible< _U1 >, __is_implicitly_default_constructible< _U2 > > > > ::value, bool >::type = false>
constexpr std::pair< _T1, _T2 >::pair ( )
inlineexplicitconstexpr

Definition at line 396 of file stl_pair.h.

◆ pair() [5/16]

template<typename _T1 , typename _T2 >
template<typename _U1 = _T1, typename _U2 = _T2, typename enable_if< _PCCP::template _ConstructiblePair< _U1, _U2 >() &&_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = true>
constexpr std::pair< _T1, _T2 >::pair ( const _T1 &  __a,
const _T2 &  __b 
)
inlineconstexpr

Construct from two const lvalues, allowing implicit conversions.

Definition at line 411 of file stl_pair.h.

◆ pair() [6/16]

template<typename _T1 , typename _T2 >
template<typename _U1 = _T1, typename _U2 = _T2, typename enable_if< _PCCP::template _ConstructiblePair< _U1, _U2 >() &&!_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool >::type = false>
constexpr std::pair< _T1, _T2 >::pair ( const _T1 &  __a,
const _T2 &  __b 
)
inlineexplicitconstexpr

Construct from two const lvalues, disallowing implicit conversions.

Definition at line 421 of file stl_pair.h.

◆ pair() [7/16]

template<typename _T1 , typename _T2 >
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 std::pair< _T1, _T2 >::pair ( const pair< _U1, _U2 > &  __p)
inlineconstexpr

Definition at line 438 of file stl_pair.h.

◆ pair() [8/16]

template<typename _T1 , typename _T2 >
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 std::pair< _T1, _T2 >::pair ( const pair< _U1, _U2 > &  __p)
inlineexplicitconstexpr

Definition at line 447 of file stl_pair.h.

◆ pair() [9/16]

template<typename _T1 , typename _T2 >
template<typename _U1 , __enable_if_t< __and_< __not_< is_reference< _U1 > >, is_pointer< _T2 >, is_constructible< _T1, _U1 >, __not_< is_constructible< _T1, const _U1 & > >, is_convertible< _U1, _T1 > >::value, bool > = true>
constexpr std::pair< _T1, _T2 >::pair ( _U1 &&  __x,
__zero_as_null_pointer_constant  ,
  ... 
)
inlineconstexpr

Definition at line 487 of file stl_pair.h.

◆ pair() [10/16]

template<typename _T1 , typename _T2 >
template<typename _U1 , __enable_if_t< __and_< __not_< is_reference< _U1 > >, is_pointer< _T2 >, is_constructible< _T1, _U1 >, __not_< is_constructible< _T1, const _U1 & > >, __not_< is_convertible< _U1, _T1 > > >::value, bool > = false>
constexpr std::pair< _T1, _T2 >::pair ( _U1 &&  __x,
__zero_as_null_pointer_constant  ,
  ... 
)
inlineexplicitconstexpr

Definition at line 499 of file stl_pair.h.

◆ pair() [11/16]

template<typename _T1 , typename _T2 >
template<typename _U2 , __enable_if_t< __and_< is_pointer< _T1 >, __not_< is_reference< _U2 > >, is_constructible< _T2, _U2 >, __not_< is_constructible< _T2, const _U2 & > >, is_convertible< _U2, _T2 > >::value, bool > = true>
constexpr std::pair< _T1, _T2 >::pair ( __zero_as_null_pointer_constant  ,
_U2 &&  __y,
  ... 
)
inlineconstexpr

Definition at line 511 of file stl_pair.h.

◆ pair() [12/16]

template<typename _T1 , typename _T2 >
template<typename _U2 , __enable_if_t< __and_< is_pointer< _T1 >, __not_< is_reference< _U2 > >, is_constructible< _T2, _U2 >, __not_< is_constructible< _T2, const _U2 & > >, __not_< is_convertible< _U2, _T2 > > >::value, bool > = false>
constexpr std::pair< _T1, _T2 >::pair ( __zero_as_null_pointer_constant  ,
_U2 &&  __y,
  ... 
)
inlineexplicitconstexpr

Definition at line 523 of file stl_pair.h.

◆ pair() [13/16]

template<typename _T1 , typename _T2 >
template<typename _U1 , typename _U2 , typename enable_if< _PCCP::template _MoveConstructiblePair< _U1, _U2 >() &&_PCCP::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = true>
constexpr std::pair< _T1, _T2 >::pair ( _U1 &&  __x,
_U2 &&  __y 
)
inlineconstexpr

Definition at line 534 of file stl_pair.h.

◆ pair() [14/16]

template<typename _T1 , typename _T2 >
template<typename _U1 , typename _U2 , typename enable_if< _PCCP::template _MoveConstructiblePair< _U1, _U2 >() &&!_PCCP::template _ImplicitlyMoveConvertiblePair< _U1, _U2 >(), bool >::type = false>
constexpr std::pair< _T1, _T2 >::pair ( _U1 &&  __x,
_U2 &&  __y 
)
inlineexplicitconstexpr

Definition at line 543 of file stl_pair.h.

◆ pair() [15/16]

template<typename _T1 , typename _T2 >
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 std::pair< _T1, _T2 >::pair ( pair< _U1, _U2 > &&  __p)
inlineconstexpr

Definition at line 553 of file stl_pair.h.

◆ pair() [16/16]

template<typename _T1 , typename _T2 >
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 std::pair< _T1, _T2 >::pair ( pair< _U1, _U2 > &&  __p)
inlineexplicitconstexpr

Definition at line 563 of file stl_pair.h.

Member Function Documentation

◆ operator=() [1/4]

template<typename _T1 , typename _T2 >
pair & std::pair< _T1, _T2 >::operator= ( __conditional_t< __and_< is_copy_assignable< _T1 >, is_copy_assignable< _T2 > >::value, const pair< _T1, _T2 > &, const __nonesuch & >  __p)
inline

Definition at line 568 of file stl_pair.h.

◆ operator=() [2/4]

template<typename _T1 , typename _T2 >
pair & std::pair< _T1, _T2 >::operator= ( __conditional_t< __and_< is_move_assignable< _T1 >, is_move_assignable< _T2 > >::value, pair< _T1, _T2 > &&, __nonesuch && >  __p)
inlinenoexcept

Definition at line 578 of file stl_pair.h.

◆ operator=() [3/4]

template<typename _T1 , typename _T2 >
template<typename _U1 , typename _U2 >
enable_if< __and_< is_assignable< _T1 &, const_U1 & >, is_assignable< _T2 &, const_U2 & > >::value, pair & >::type std::pair< _T1, _T2 >::operator= ( const pair< _U1, _U2 > &  __p)
inline

Definition at line 593 of file stl_pair.h.

◆ operator=() [4/4]

template<typename _T1 , typename _T2 >
template<typename _U1 , typename _U2 >
enable_if< __and_< is_assignable< _T1 &, _U1 && >, is_assignable< _T2 &, _U2 && > >::value, pair & >::type std::pair< _T1, _T2 >::operator= ( pair< _U1, _U2 > &&  __p)
inline

Definition at line 604 of file stl_pair.h.

◆ swap()

template<typename _T1 , typename _T2 >
constexpr void std::pair< _T1, _T2 >::swap ( pair< _T1, _T2 > &  __p)
inlineconstexprnoexcept

Member Data Documentation

◆ first

◆ second


The documentation for this struct was generated from the following files: