Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

atomic_fetch_add_explicit Function

Adds a value to an existing value that is stored in an atomic object.

template <class T> T* atomic_fetch_add_explicit(
   volatile atomic<T*> *Atom,
   ptrdiff_t Value,
   memory_order Order
) noexcept;

template <class T> T* atomic_fetch_add_explicit(
   atomic<T*> *Atom,
   ptrdiff_t Value,
   memory_order Order
) noexcept;

Atom

A pointer to an atomic object that stores a pointer to type T.

Value

A value of type ptrdiff_t.

The value of the pointer contained by the atomic object immediately before the operation was performed.

The atomic_fetch_add_explicit function performs a read-modify-write operation to atomically add Value to the stored value in Atom, within the memory_order constraints that are specified by Order.

When the atomic type is atomic_address, Value has type ptrdiff_t and the operation treats the stored pointer as a char *.

This operation is also overloaded for integral types:

integral atomic_fetch_add_explicit(
    volatile atomic-integral * Atom, integral Value, memory_order Order
) noexcept;

integral atomic_fetch_add_explicit(
    atomic-integral * Atom, integral Value, memory_order Order
) noexcept;

Header: atomic

Namespace: std

Show:
© 2015 Microsoft