5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ATOMIC_ATOMIC_MONOTONIC_COUNTER_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_ATOMIC_ATOMIC_MONOTONIC_COUNTER_HPP_
14#include "arene/base/stdlib_choice/cstdint.hpp"
32 "arene::base::atomic_monotonic_counter requires compiler builtin atomic operations"
47 : value_{initial_value} {}
66 auto load() const noexcept ->
value_type {
return __atomic_load_n(&value_, __ATOMIC_SEQ_CST); }
constexpr atomic_monotonic_counter(value_type const initial_value) noexcept
Constructor with initial value.
Definition atomic_monotonic_counter.hpp:46
constexpr atomic_monotonic_counter() noexcept
Default constructor initializing counter to 0.
Definition atomic_monotonic_counter.hpp:41
auto load() const noexcept -> value_type
Atomically loads and returns the current counter value.
Definition atomic_monotonic_counter.hpp:66
auto operator++() noexcept -> value_type
Pre-increment operator.
Definition atomic_monotonic_counter.hpp:54
std::uint64_t value_type
The value type of the counter.
Definition atomic_monotonic_counter.hpp:38
auto operator++(int) noexcept -> value_type
Post-increment operator.
Definition atomic_monotonic_counter.hpp:61
#define ARENE_IS_ON(OP_SYMBOL)
Evaluates if the given compile time configuration symbol is "on".
Definition define_configuration.hpp:35
#define ARENE_HAS_BUILTIN_ATOMIC
A platform support query for testing if compiler atomic intrinsics are defined.
Definition has_builtin_atomic.hpp:53
Definition accumulate.hpp:37
Definition accumulate.hpp:36
::uint64_t uint64_t
A 64-bit unsigned integer type.
Definition cstdint.hpp:47