Share via


atomic::fetch_add Method

Fetches the value stored in *this, and then adds a specified value to the stored value.

Ty atomic<Ty>::fetch_add (
   Ty Value,
   memory_order Order = memory_order_seq_cst
) volatile _NOEXCEPT;
Ty atomic<Ty>::fetch_add (
   Ty Value,
   memory_order Order = memory_order_seq_cst
) _NOEXCEPT;

Parameters

Return Value

A Ty object that contains the value stored in *this prior to the addition.

Remarks

The fetch_add method performs a read-modify-write operation to atomically add Value to the stored value in *this, and applies the memory constraints that are specified by Order.

Requirements

Header: atomic

Namespace: std

See Also

Reference

<atomic>

atomic Structure

atomic_fetch_add_explicit Function