Namespaces
Variants
Views
Actions

std::atomic::operator=

From cppreference.com
< cpp‎ | atomic‎ | atomic
Revision as of 07:27, 5 November 2012 by Cubbi (Talk | contribs)

 
 
 
 

Template:ddcl list begin <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
T operator=( T desired );
</td>

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
T operator=( T desired ) volatile;
</td>

<td > (1) </td> <td > (since C++11) </td> </tr> <tr class="t-dcl-sep"><td></td><td></td><td></td></tr>

<tr class="t-dcl ">

<td >
atomic& operator=( const atomic& ) = delete;
atomic& operator=( const atomic& ) volatile = delete;
</td>

<td > (2) </td> <td > (since C++11) </td> </tr> Template:ddcl list end

1) Atomically assigns a value t to the atomic variable. Equivalent to store(desired).
2) Atomic variables are not CopyAssignable.

Contents

Parameters

desired - value to assign

Return value

desired.

Exceptions

noexcept specification:  
noexcept
  

Notes

Unlike most assignment operators, the assignment operators for atomic types do not return a reference to their left-hand arguments. They return a copy of the stored value instead.

See also

Template:cpp/atomic/atomic/dcl list constructor