Documentation Home >> Headers >> <atomic> Header >> std::atomic_address >> std::atomic_address::fetch_sub member function

Atomically load a value and replace it with the difference of that value and the supplied value i.

void* fetch_sub(
    ptrdiff_t i,
    memory_order order = memory_order_seq_cst)
    volatile;

Effects:

Atomically retrieves the existing value of *this and stores (void*)((char*)old-value - i) in *this.

Returns:

The value of *this immediately prior to the store.

Throws:

Nothing.

Note:

This is an atomic read-modify-write operation for the memory location comprising *this.

Header

#include <atomic>

See Also