__GNU_CXX::PAIR(3cxx)

πŸ‘‘ __gnu_cxx::pair< _T1, _T2 > β€” section 3cxx, straight from libstdc++

okay so bestie, imagine a struct that just... holds two things. that's it. that's the whole vibe. two objects, any types you want, sitting next to each other in main character energy. this is the 3cxx manual page for __gnu_cxx::pair< _T1, _T2 >, and yes we're going through every single line of it because you deserve the full lore. πŸ’…


🌸 NAME 🌸

__gnu_cxx::pair< _T1, _T2 > β€” Struct holding two objects of arbitrary type.

like. it's a little buddy system for two values. iconic behavior, honestly. 🫢


✨ SYNOPSIS ✨

#include <utility>

πŸŽ€ Public Types πŸŽ€

  • typedef _T1 first_type β€” The type of the first member.
  • typedef _T2 second_type β€” The type of the second member.

two typedefs, no notes, they're doing their jobs. πŸ’–

πŸ¦‹ Public Member Functions πŸ¦‹

okay this is the long part and I need you to stay with me, we're going through all of them:

  • constexpr pair (const pair &)=default β€” Copy constructor.
  • constexpr pair (pair &&)=default β€” Move constructor.
  • template<typename... _Args1, typename... _Args2> constexpr pair (piecewise_construct_t, tuple< _Args1... >, tuple< _Args2... >)
  • template<typename _U1, typename _U2> requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>())constexpr explicit (!_S_convertible< _U1, _U2 >()) pair(_U1 &&"
  • template<typename _U1, typename _U2> requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())constexpr explicit (!_S_convertible< _U1, _U2 >()) pair(_U1 &&__x" β€” Constructor accepting two values of arbitrary types.
  • template<typename _U1, typename _U2> requires (_S_constructible<_U1, _U2>()) && (_S_dangles<_U1, _U2>())constexpr explicit (!_S_convertible< _U1, _U2 >()) pair(pair< _U1"
  • template<typename _U1, typename _U2> requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())constexpr _U2 &constexpr explicit (!_S_convertible< _U1, _U2 >()) pair(pair< _U1" β€” Converting constructor from a non-const pair<U1, U2> rvalue.
  • constexpr explicit (!_S_convertible< const _T1 &, const _T2 & >()) pair(const type_identity_t< _T1 > &__x β€” Constructor accepting lvalues of first_type and second_type.
  • template<typename _U1, typename _U2> requires (_S_constructible<const _U1&, const _U2&>()) && (_S_dangles<const _U1&, const _U2&>())constexpr explicit (!_S_convertible< const _U1 &, const _U2 & >()) pair(const pair< _U1"
  • template<typename _U1, typename _U2> requires (_S_constructible<const _U1&, const _U2&>()) && (!_S_dangles<_U1, _U2>())constexpr _U2 &&constexpr explicit (!_S_convertible< const _U1 &, const _U2 & >()) pair(const pair< _U1" β€” Converting constructor from a const pair<U1, U2> lvalue.
  • constexpr explicit (__not_< __and_< __is_implicitly_default_constructible< _T1 >, __is_implicitly_default_constructible< _T2 > > >()) pair() noexcept(is_nothrow_default_constructible_v< _T1 > &&is_nothrow_default_constructible_v< _T2 >) β€” Default constructor.
  • constexpr _U2 &constexpr _U2 &&__p noexcept (_S_nothrow_constructible< _U1, _U2 >())
  • constexpr _U2 &&__y noexcept (_S_nothrow_constructible< _U1, _U2 >())
  • constexpr const _T2 &__y noexcept (_S_nothrow_constructible< const _T1 &, const _T2 & >())
  • constexpr _U2 &&constexpr _U2 &__p noexcept (_S_nothrow_constructible< const _U1 &, const _U2 & >())
  • pair & operator= (const pair &)=delete
  • constexpr pair & operator= (const pair &__p) noexcept(_S_nothrow_assignable< const _T1 &, const _T2 & >()) β€” Copy assignment operator.
  • template<typename _U1, typename _U2> requires (_S_assignable<const _U1&, const _U2&>())constexpr pair & operator= (const pair< _U1, _U2 > &__p) noexcept(_S_nothrow_assignable< const _U1 &, const _U2 & >())" β€” Converting assignment from a const pair<U1, U2> lvalue.
  • constexpr pair & operator= (pair &&__p) noexcept(_S_nothrow_assignable< _T1, _T2 >()) β€” Move assignment operator.
  • template<typename _U1, typename _U2> requires (_S_assignable<_U1, _U2>())constexpr pair & operator= (pair< _U1, _U2 > &&__p) noexcept(_S_nothrow_assignable< _U1, _U2 >())" β€” Converting assignment from a non-const pair<U1, U2> rvalue.
  • constexpr void swap (pair &__p) noexcept(__and_< __is_nothrow_swappable< _T1 >, __is_nothrow_swappable< _T2 > >::value) β€” Swap the first members and then the second members.
not me pasting a whole wall of requires clauses and still being obsessed with it 😭 anyway. every one of those is real, don't let anyone tell you otherwise.

🌈 Public Attributes 🌈

  • _T1 first β€” The first member.
  • _T2 second β€” The second member.

(Note that these are not member symbols.)

  • template<typename _T1, typename _T2> pair (_T1, _T2) -> pair< _T1, _T2 >
  • 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)))
  • template<typename _T1, typename _T2, typename _U1, typename _U2> constexpr bool operator== (const pair< _T1, _T2 > &__x, const pair< _U1, _U2 > &__y) β€” Two pairs are equal iff their members are equal.
  • template<typename _T1, typename _T2, typename _U1, typename _U2> constexpr common_comparison_category_t< __detail::__synth3way_t< _T1, _U1 >, __detail::__synth3way_t< _T2, _U2 > > operator<=> (const pair< _T1, _T2 > &__x, const pair< _U1, _U2 > &__y)

πŸ’« Detailed Description πŸ’«

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

Struct holding two objects of arbitrary type.

Template Parameters

  • _T1 β€” Type of first object.
  • _T2 β€” Type of second object.

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

go read the docs bestie, they're right there, I'm literally handing you the link πŸŽ€


🧚 Member Typedef Documentation 🧚

  • template<typename _T1, typename _T2> typedef _T1 std::pair< _T1, _T2 >::first_type β€” The type of the first member.
  • template<typename _T1, typename _T2> typedef _T2 std::pair< _T1, _T2 >::second_type β€” The type of the second member.

πŸ“ Constructor & Destructor Documentation πŸ“

  • template<typename _T1, typename _T2> std::pair< _T1, _T2 >::pair (const pair< _T1, _T2 > & ) [constexpr], [default] β€” Copy constructor.
  • template<typename _T1, typename _T2> std::pair< _T1, _T2 >::pair (pair< _T1, _T2 > && ) [constexpr], [default] β€” Move constructor.

both of them are just vibing at default, as they should. πŸ’–


πŸ’… Member Function Documentation πŸ’…

  • template<typename _T1, typename _T2> template<typename _U1, typename _U2> requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())std::pair< _T1, _T2 >::explicit (!_S_convertible< _U1, _U2 > ()) && [constexpr]"

Constructor accepting two values of arbitrary types.

  • template<typename _T1, typename _T2> template<typename _U1, typename _U2> requires (_S_constructible<_U1, _U2>()) && (!_S_dangles<_U1, _U2>())_U2 &constexpr std::pair< _T1, _T2 >::explicit (!_S_convertible< _U1, _U2 > ()) [constexpr]"

Converting constructor from a non-const pair<U1, U2> rvalue.

  • template<typename _T1, typename _T2> std::pair< _T1, _T2 >::explicit (!_S_convertible< const _T1 &, const _T2 & > ()) const & [constexpr] β€” Constructor accepting lvalues of first_type and second_type.
  • template<typename _T1, typename _T2> template<typename _U1, typename _U2> requires (_S_constructible<const _U1&, const _U2&>()) && (!_S_dangles<_U1, _U2>())_U2 &&constexpr std::pair< _T1, _T2 >::explicit (!_S_convertible< const _U1 &, const _U2 & > ()) const [constexpr]"

Converting constructor from a const pair<U1, U2> lvalue.

  • template<typename _T1, typename _T2> std::pair< _T1, _T2 >::explicit (__not_< __and_< __is_implicitly_default_constructible< _T1 >, __is_implicitly_default_constructible< _T2 > > > ()) [inline], [constexpr], [noexcept] β€” Default constructor.
  • template<typename _T1, typename _T2> pair & std::pair< _T1, _T2 >::operator= (const pair< _T1, _T2 > & __p) [inline], [constexpr], [noexcept] β€” Copy assignment operator.
  • template<typename _T1, typename _T2> template<typename _U1, typename _U2> requires (_S_assignable<const _U1&, const _U2&>())pair & std::pair< _T1, _T2 >::operator= (const pair< _U1, _U2 > & __p) [inline], [constexpr], [noexcept]"

Converting assignment from a const pair<U1, U2> lvalue.

  • template<typename _T1, typename _T2> pair & std::pair< _T1, _T2 >::operator= (pair< _T1, _T2 > && __p) [inline], [constexpr], [noexcept] β€” Move assignment operator.
  • template<typename _T1, typename _T2> template<typename _U1, typename _U2> requires (_S_assignable<_U1, _U2>())pair & std::pair< _T1, _T2 >::operator= (pair< _U1, _U2 > && __p) [inline], [constexpr], [noexcept]"

Converting assignment from a non-const pair<U1, U2> rvalue.

  • template<typename _T1, typename _T2> void std::pair< _T1, _T2 >::swap (pair< _T1, _T2 > & __p) [inline], [constexpr], [noexcept] β€” Swap the first members and then the second members.

πŸ¦„ Member Data Documentation πŸ¦„

  • template<typename _T1, typename _T2> _T1 std::pair< _T1, _T2 >::first β€” The first member.
  • template<typename _T1, typename _T2> _T2 std::pair< _T1, _T2 >::second β€” The second member.

🌟 Author 🌟

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


and that's the whole page bestie!! πŸ’– this beauty lives in the libstdc++ collection, filed under section 3cxx as __gnu_cxx::pair< _T1, _T2 >(3cxx) β€” no date stamp on it, just pure un-dated icon energy. go forth and hold two objects at once, you've got this πŸ«Άβœ¨πŸŽ€

πŸ“¦ where this page comes from