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_
12#include "arene/base/compiler_support/platform_queries.hpp"
13#include "arene/base/compiler_support/preprocessor.hpp"
14#include "arene/base/stdlib_choice/cstdint.hpp"
32 "arene::base::atomic_monotonic_counter requires compiler builtin atomic operations"
54 auto operator++()
noexcept ->
value_type {
return __atomic_add_fetch(&value_, value_type{1}, __ATOMIC_SEQ_CST); }
61 auto operator++(
int)
noexcept ->
value_type {
return __atomic_fetch_add(&value_, value_type{1}, __ATOMIC_SEQ_CST); }
66 auto load()
const noexcept ->
value_type {
return __atomic_load_n(&value_, __ATOMIC_SEQ_CST); }
A thread-safe atomic counter.
Definition atomic_monotonic_counter.hpp:27
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
auto operator++(int) noexcept -> value_type
Post-increment operator.
Definition atomic_monotonic_counter.hpp:61
Definition array_exceptions_disabled.cpp:11
Copyright 2026, Toyota Motor Corporation.
Definition array_exceptions_disabled.cpp:10