logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

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

Author

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

                                                    libstdc++                        std::pair<_T1,_T2>(3cxx)

Constructor & Destructor Documentation

template<typename_T1,typename_T2>constexprstd::pair<_T1,_T2>::pair(constpair<_T1,_T2>&)[constexpr],[default]
       Copy constructor.

   template<typename_T1,typename_T2>constexprstd::pair<_T1,_T2>::pair(pair<_T1,_T2>&&)[constexpr],[default]
       Move constructor.

   template<typename_T1,typename_T2>template<typename_U1=_T1,typename_U2=_T2,typenameenable_if<__and_<__is_implicitly_default_constructible<_U1>,__is_implicitly_default_constructible<_U2>>::value,bool>::type=true>constexprstd::pair<_T1,_T2>::pair()[inline],[constexpr]
       The default constructor creates first and second using their respective default constructors.

   template<typename_T1,typename_T2>template<typename_U1=_T1,typename_U2=_T2,typenameenable_if<_PCCP::template_ConstructiblePair<_U1,_U2>()&&_PCCP::template_ImplicitlyConvertiblePair<_U1,_U2>(),bool>::type=true>constexprstd::pair<_T1,_T2>::pair(const_T1&__a,const_T2&__b)[inline],[constexpr]
       Construct from two const lvalues, allowing implicit conversions.

   template<typename_T1,typename_T2>template<typename_U1=_T1,typename_U2=_T2,typenameenable_if<_PCCP::template_ConstructiblePair<_U1,_U2>()&&!_PCCP::template_ImplicitlyConvertiblePair<_U1,_U2>(),bool>::type=false>constexprstd::pair<_T1,_T2>::pair(const_T1&__a,const_T2&__b)[inline],[explicit],[constexpr]
       Construct from two const lvalues, disallowing implicit conversions.

Detailed Description

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

       TemplateParameters_T1 Type of first object.
           _T2 Type of second object.

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

Member Data Documentation

template<typename_T1,typename_T2>_T1std::pair<_T1,_T2>::first
       The first member.

       Referenced by std::pair<_T1,_T2>::swap().

   template<typename_T1,typename_T2>_T2std::pair<_T1,_T2>::second
       The second member.

       Referenced by std::pair<_T1,_T2>::swap().

Member Function Documentation

template<typename_T1,typename_T2>constexprvoidstd::pair<_T1,_T2>::swap(pair<_T1,_T2>&__p)[inline],[constexpr],[noexcept]
       Swap the first members and then the second members.

       References std::pair<_T1,_T2>::first, std::pair<_T1,_T2>::second, std::swap(), and std::pair<_T1,_T2>::swap().

       Referenced by std::pair<_T1,_T2>::swap(), and std::sub_match<_BiIter>::swap().

Member Typedef Documentation

template<typename_T1,typename_T2>typedef_T1std::pair<_T1,_T2>::first_type
       The type of the first member.

   template<typename_T1,typename_T2>typedef_T2std::pair<_T1,_T2>::second_type
       The type of the second member.

Name

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

Synopsis

       #include <utility>

       Inherits __pair_base< _T1, _T2 >.

   PublicTypestypedef _T1 first_type
           The type of the first member.
       typedef _T2 second_type
           The type of the second member.

   PublicMemberFunctions
       template<typename_U1  = _T1, typename_U2  = _T2, typenameenable_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 , typenameenable_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 , typenameenable_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, typenameenable_if< _PCCP::template
           _ConstructiblePair< _U1, _U2 >() &&_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool
           >::type  = true> constexpr pair (const _T1 &__a, const _T2 &__b)
           Construct from two const lvalues, allowing implicit conversions.
       template<typename_U1  = _T1, typename_U2  = _T2, typenameenable_if< _PCCP::template
           _ConstructiblePair< _U1, _U2 >() &&!_PCCP::template _ImplicitlyConvertiblePair< _U1, _U2 >(), bool
           >::type  = false> constexpr pair (const _T1 &__a, const _T2 &__b)
           Construct from two const lvalues, disallowing implicit conversions.
       constexpr pair (const pair &)=default
           Copy constructor.
       template<typename_U1 , typename_U2 , typenameenable_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 , typenameenable_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
           Move constructor.
       template<typename_U1 , typename_U2 , typenameenable_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 , typenameenable_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... >)
       pair & operator= (__conditional_t< __and_< is_copy_assignable< _T1 >, is_copy_assignable< _T2 > >::value,
           const pair &, const __nonesuch & > __p)
       pair & operator= (__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 voidswap (pair &__p) noexcept(__and_< __is_nothrow_swappable< _T1 >, __is_nothrow_swappable<
           _T2 > >::value)
           Swap the first members and then the second members.

   PublicAttributes
       _T1 first
           The first member.
       _T2 second
           The second member.

   RelatedSymbols
       (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)
           A convenience wrapper for creating a pair from two objects.

           template<typename _T1 , typename _T2 > pair (_T1, _T2) -> pair< _T1, _T2 >
               Two pairs of the same type are equal iff their members are equal.
           template<typename _T1 , typename _T2 > constexpr bool operator== (const pair< _T1, _T2 > &__x, const
               pair< _T1, _T2 > &__y)
               Two pairs of the same type are equal iff their members are equal.
           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)
               Uses operator== to find the result.
           template<typename _T1 , typename _T2 > constexpr bool operator> (const pair< _T1, _T2 > &__x, const
               pair< _T1, _T2 > &__y)
               Uses operator< to find the result.
           template<typename _T1 , typename _T2 > constexpr bool operator<= (const pair< _T1, _T2 > &__x, const
               pair< _T1, _T2 > &__y)
               Uses operator< to find the result.
           template<typename _T1 , typename _T2 > constexpr bool operator>= (const pair< _T1, _T2 > &__x, const
               pair< _T1, _T2 > &__y)
               Uses operator< to find the result.
           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)))

See Also