Template Class VersionedVariable

Class Documentation

template<typename T>
class VersionedVariable

Requires: std::copy_constructible<T> && std::assignable_from<T&, T> && std::equality_comparable<T>

Synchronizes one value and its revision as a unit.

Repeated equal sets do not advance the revision. Readers can retain a revision and wait for a later change without missing a change between reads. Comparison/copy/assignment execute under the storage mutex and must not reenter this variable. Their exceptions propagate; throwing assignment follows T’s own failure guarantee and may change a value without advancing revision/notifying. Keep the variable alive through all readers/waiters; destruction is not cancellation.

Public Functions

inline explicit VersionedVariable(T initial)
inline void set(T next)
inline ::CE::State::VersionedSnapshot<T> snapshot() const

Declaration: [[nodiscard]]

inline T get() const

Declaration: [[nodiscard]]

inline std::uint64_t revision() const

Declaration: [[nodiscard]]

inline ::CE::State::VersionedSnapshot<T> wait_for_change(std::uint64_t since) const

Declaration: [[nodiscard]]