|
constexpr | pair (pair &&p) noexcept=default |
| Move constructor is defaulted, and is constexpr if moving of both elements satisfies the requirements on constexpr functions.
|
|
constexpr | pair (pair const &p)=default |
| Copy constructor is defaulted, and is constexpr if copying of both elements satisfies the requirements on constexpr functions.
|
|
| ~pair () noexcept=default |
| Defaulted destructor.
|
|
| explicit (not is_convertible_v< T1 const &, T1 > or not is_convertible_v< T2 const &, T2 >) const expr pair(T1 const &t1 |
| Initializes first with x and second with y.
|
|
template<typename U1, typename U2>
requires (is_constructible_v<T1, U1 &&> and is_constructible_v<T2, U2 &&>) |
| explicit (not is_convertible_v< U1 &&, T1 >||not is_convertible_v< U2 &&, T2 >) const expr pair(pair< U1 |
| Initializes first with forward<U1>(p.first) and second with forward<U2>(p.second).
|
|
template<typename U1 = T1, typename U2 = T2>
requires (is_constructible_v<T1, U1 &&> and is_constructible_v<T2, U2 &&>) |
| explicit (not is_convertible_v< U1 &&, T1 >||not is_convertible_v< U2 &&, T2 >) const expr pair(U1 &&x |
| Initializes first with forward<U1>(x) and second with forward<U2>(y).
|
|
template<typename U1, typename U2>
requires (is_constructible_v<T1, U1 const&> and is_constructible_v<T2, U2 const&>) |
| explicit (not is_convertible_v< U1 const &, T1 > or not is_convertible_v< U2 const &, T2 >) const expr pair(pair< U1 |
| Initializes first with p.first and second with p.second.
|
|
| explicit (not is_implicit_default_constructible_v< T1 >||not is_implicit_default_constructible_v< T2 >) const expr pair() |
| Default constructor. Value-initializes both elements.
|
|
constexpr auto | operator= (pair &&p) noexcept -> pair &requires((is_move_assignable_v< first_type > and is_move_assignable_v< second_type >)) |
|
constexpr auto | operator= (pair const &p) -> pair &=default |
|
template<typename U1, typename U2>
requires (is_assignable_v<first_type&, U1> and is_assignable_v<second_type&, U2>) |
constexpr auto | operator= (pair< U1, U2 > &&p) -> pair & |
|
template<typename U1, typename U2> |
constexpr auto | operator= (pair< U1, U2 > const &p) -> pair &requires((is_assignable_v< first_type &, U1 const & > and is_assignable_v< second_type &, U2 const & >)) |
|
U2 | second (etl::forward< U2 >(p.second)) |
|
U2 | second (etl::forward< U2 >(y)) |
|
U2 const | second (p.second) |
|
T2 const | second (t2) |
|
constexpr auto | swap (pair &other) noexcept(is_nothrow_swappable_v< first_type > and is_nothrow_swappable_v< second_type >) -> void |
|
template<typename T1, typename T2>
struct etl::pair< T1, T2 >
etl::pair is a class template that provides a way to store two heterogeneous objects as a single unit. A pair is a specific case of a etl::tuple with two elements. If neither T1 nor T2 is a possibly cv-qualified class type with non-trivial destructor, or array thereof, the destructor of pair is trivial.
https://en.cppreference.com/w/cpp/utility/pair
- Examples
- utility.cpp.