std::pair<T1,T2>::operator=
From cppreference.com
(1) | ||
pair& operator=( const pair& other ); |
(until C++20) | |
constexpr pair& operator=( const pair& other ); |
(since C++20) | |
constexpr const pair& operator=( const pair& other ) const; |
(2) | (since C++23) |
(3) | ||
template< class U1, class U2 > pair& operator=( const pair<U1, U2>& other ); |
(until C++20) | |
template< class U1, class U2 > constexpr pair& operator=( const pair<U1, U2>& other ); |
(since C++20) | |
template< class U1, class U2 > constexpr const pair& operator=( const pair<U1, U2>& other ) const; |
(4) | (since C++23) |
(5) | ||
pair& operator=( pair&& other ) noexcept(/* see below */); |
(since C++11) (until C++20) |
|
constexpr pair& operator=( pair&& other ) noexcept(/* see below */); |
(since C++20) | |
constexpr const pair& operator=( pair&& other ) const; |
(6) | (since C++23) |
(7) | ||
template< class U1, class U2 > pair& operator=( pair<U1, U2>&& p ); |
(since C++11) (until C++20) |
|
template< class U1, class U2 > constexpr pair& operator=( pair<U1, U2>&& p ); |
(since C++20) | |
template< class U1, class U2 > constexpr const pair& operator=( pair<U1, U2>&& p ) const; |
(8) | (since C++23) |
template< pair-like P > constexpr pair& operator=( P&& u ); |
(9) | (since C++23) |
template< pair-like P > constexpr const pair& operator=( P&& u ) const; |
(10) | (since C++23) |
Replaces the contents of the pair.
1) Copy assignment operator. Replaces the contents with a copy of the contents of other.
The assignment operator is implicitly declared. Using this assignment operator makes the program ill-formed if either |
(until C++11) |
This overload is defined as deleted if either std::is_copy_assignable<T1>::value or std::is_copy_assignable<T2>::value is false. |
(since C++11) |
2) Copy assignment operator for const-qualified operand.
This overload participates in overload resolution only if std::is_copy_assignable_v<const T1> and std::is_copy_assignable_v<const T2> are both true.
3) Assigns other.first to
first
and other.second to second
.
This overload participates in overload resolution only if std::is_assignable<T1&, const U1&>::value and std::is_assignable<T2&, const U2&>::value are both true. |
(since C++11) |
4) Assigns other.first to
first
and other.second to second
. This overload participates in overload resolution only if std::is_assignable_v<const T1&, const U1&> and std::is_assignable_v<const T2&, const U2&> are both true.
5) Move assignment operator. Replaces the contents with those of other using move semantics.
This overload participates in overload resolution only if std::is_move_assignable<T1>::value and std::is_move_assignable<T2>::value are both true.
6) Move assignment operator for const-qualified operand.
This overload participates in overload resolution only if std::is_assignable_v<const T1&, T1> and std::is_assignable_v<const T2&, T2> are both true.
This overload participates in overload resolution only if std::is_assignable<T1&, U1>::value and std::is_assignable<T2&, U2>::value are both true.
This overload participates in overload resolution only if