Namespaces
Variants
Views
Actions

std::pair<T1,T2>::operator=

From cppreference.com
< cpp‎ | utility‎ | pair
Revision as of 12:34, 11 October 2011 by P12bot (Talk | contribs)

Template:cpp/utility/pair/sidebar Template:ddcl list begin <tr class="t-dcl ">

<td >
pair& operator=( const pair& other );
</td>

<td > (1) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
template< class U1, class U2 >
pair& operator=( const pair<U1,U2>& other );
</td>

<td > (2) </td> <td class="t-dcl-nopad"> </td> </tr> <tr class="t-dcl ">

<td >
pair& operator=( pair&& other );
</td>

<td > (3) </td> <td > Template:mark c++11 feature </td> </tr> <tr class="t-dcl ">

<td >
template< class U1, class U2 >
pair& operator=( pair<U1,U2>&& other );
</td>

<td > (4) </td> <td > Template:mark c++11 feature </td> </tr> Template:ddcl list end

Replaces the contents of the pair.

1) Copy assignment operator. Replaces the contents with a copy of the contents of other.

2) Assigns other.first to first and other.second to second

3) Move assignment operator. Replaces the contents with those of other using move semantics.

4) Assigns Template:cpp to first and Template:cpp to second.

Contents

Parameters

other - pair of values to replace the contents of this pair

Return value

Template:cpp

Exceptions

1-2) (none)

3)
noexcept specification:  
noexcept(noexcept(

    is_nothrow_move_assignable<T1>::value &&
    is_nothrow_move_assignable<T2>::value

))

4) (none)

Example

Template:example cpp

See also