std::tuple<Types...>::operator=
From cppreference.com
tuple& operator=( const tuple& other );
|
(1) | (since C++11) (constexpr since C++20) |
constexpr const tuple& operator=( const tuple& other ) const;
|
(2) | (since C++23) |
tuple& operator=( tuple&& other ) noexcept(/* see below */);
|
(3) | (since C++11) (constexpr since C++20) |
constexpr const tuple& operator=( tuple&& other ) const;
|
(4) | (since C++23) |
template< class... UTypes >
tuple& operator=( const tuple<UTypes...>& other );
|
(5) | (since C++11) (constexpr since C++20) |
template< class... UTypes >
constexpr const tuple& operator=( const tuple<UTypes...>& other ) const;
|
(6) | (since C++23) |
template< class... UTypes >
tuple& operator=( tuple<UTypes...>&& other );
|
(7) | (since C++11) (constexpr since C++20) |
template< class... UTypes >
constexpr const tuple& operator=( tuple<UTypes...>&& other ) const;
|
(8) | (since C++23) |
template< class E1, class E2 >
tuple& operator=( const std::pair<E1, E2>& p );
|
(9) | (since C++11) (constexpr since C++20) |
template< class E1, class E2 >
constexpr const tuple& operator=( const std::pair<E1, E2>& p ) const;
|
(10) | (since C++23) |
template< class E1, class E2 >
tuple& operator=( std::pair<E1, E2>&& p );
|
(11) | (since C++11) (constexpr since C++20) |
template< class E1, class E2 >
constexpr const tuple& operator=( std::pair<E1, E2>&& p ) const;
|
(12) | (since C++23) |
template< tuple-like UTuple >
constexpr tuple& operator=( UTuple&& u );
|
(13) | (since C++23) |
template< tuple-like UTuple >
constexpr const tuple& operator=( UTuple&& u ) const;
|
(14) | (since C++23) |
Replaces the contents of the tuple with the contents of another tuple-like object.
In the descriptions that follow, let
ibe in the range[0,sizeof...(Types))in order,Tibe theith type in the class template parameter packTypes, andUibe theith type in a function template parameter pack namedUTypes,
where indexing is zero-based.
1) Copy assignment operator. Assigns each element of
other to the corresponding element of *this. This overload is defined as deleted unless
std::is_copy_assignable<Ti>::value is true for all Ti.2) Copy assignment operator for const-qualified operand. Assigns each element of
other to the corresponding element of *this. This overload participates in overload resolution only if
std::is_copy_assignable_v<const Ti> is true for all Ti.3) Move assignment operator. For all
i, assigns std::forward<Ti>(std::get<i>(other)) to std::get<i>(*this). This overload participates in overload resolution only if
std::is_move_assignable<Ti>::value is true for all Ti.4) Move assignment operator for const-qualified operand. For all
i, assigns std::forward<Ti>(std::get<i>(other)) to std::get<i>(*this). This overload participates in overload resolution only if
std::is_assignable_v<const Ti&, Ti> is true for all Ti.5) For all
i, assigns std::get<i>(other) to std::get<i>(*this). This overload participates in overload resolution only if
sizeof...(Types) == sizeof...(UTypes), and std::is_assignable<Ti&, const Ui&>::value is true for all corresponding pairs of types Ti and Ui.6) For all
i, assigns std::get<i>(other) to std::get<i>(*this). This overload participates in overload resolution only if
sizeof...(Types) == sizeof...(UTypes), and std::is_assignable_v<const Ti&, const Ui&> is true for all corresponding pairs of types Ti and Ui.7) For all
i, assigns std::forward<Ui>(std::get<i>(other)) to std::get<i>(*this). This overload participates in overload resolution only if
sizeof...(Types) == sizeof...(UTypes), and std::is_assignable<Ti&, Ui>::value is true for all corresponding pairs of types Tiand Ui.8) For all
i, assigns std::forward<Ui>(std::get<i>(other)) to std::get<i>(*this). This overload participates in overload resolution only if
sizeof...(Types) == sizeof...(UTypes), and std::is_assignable_v<const Ti&, Ui> is true for all corresponding pairs of types Ti and Ui.9) Assigns
p.first to the first element of *this and p.second to the second element of *this. This overload participates in overload resolution only if
sizeof...(Types) == 2,std::is_assignable<T0&, const E1&>::valueistrue, andstd::is_assignable<T1&, const E2&>::valueistrue.
10) Assigns
p.first to the first element and p.second to the second element. This overload participates in overload resolution only if
sizeof...(Types) == 2,std::is_assignable_v<const T0&, const E1&>istrue, andstd::is_assignable_v<const T1&, const E2&>istrue.
11) Assigns
std::forward<E1>(p.first) to the first element of *this and std::forward<E2>(p.second) to the second element of *this. This overload participates in overload resolution only if
sizeof...(Types) == 2,std::is_assignable_v<T0&, E1>istrue, andstd::is_assignable_v<T1&, E2>istrue.
12) Assigns
std::forward<E1>(p.first) to the first element and std::forward<E2>(p.second) to the second element. This overload participates in overload resolution only if
sizeof...(Types) == 2,std::is_assignable_v<const T0&, E1>istrue, andstd::is_assignable_v<const T1&, E2>istrue.
13) For all
i, assigns std::get<i>(std::forward<UTuple>(u)) to std::get<i>(*this). This overload participates in overload resolution only if
std::same_as<std::remove_cvref_t<UTuple>, std::tuple>isfalse,std::remove_cvref_t<UTuple>is not a specialization of std::ranges::subrange,sizeof...(Types)equalsstd::tuple_size_v<std::remove_cvref_t<UTuple>>, andstd::is_assignable_v<Ti&, decltype(std::get<i>(std::forward<UTuple>(u)))>istruefor alli.
14) For all
i, assigns std::get<i>(std::forward<UTuple>(u)) to std::get<i>(*this). This overload participates in overload resolution only if
std::same_as<std::remove_cvref_t<UTuple>, std::tuple>isfalse,std::remove_cvref_t<UTuple>is not a specialization of std::ranges::subrange,sizeof...(Types)equalsstd::tuple_size_v<std::remove_cvref_t<UTuple>>, andstd::is_assignable_v<const Ti&, decltype(std::get<i>(std::forward<UTuple>(u)))>istruefor alli.