Class for mutable variables with history. More...
#include <eagine/value_with_history.hpp>
Public Member Functions | |
constexpr | variable_with_history () noexcept=default |
Default constructor. | |
constexpr | variable_with_history (const T &initial) noexcept |
Initialize the all revisions to the initial value. | |
auto | assign (const T &new_value) -> bool |
Shifts the revisions and assigns a new value. | |
auto | advance (const T &delta_value) -> bool |
Shifts the revisions and advanced the current value by given delta. | |
![]() | |
template<typename... I> | |
constexpr | value_with_history (I &&... initial) |
Initialized the individual revisions of this value. | |
auto | values () const noexcept -> const value_with_history_storage< T, N > & |
Returns a reference to the value storage. | |
auto | get () const noexcept |
Returns the current revision of the value. More... | |
auto | value () const noexcept |
Returns the current revision of the value. More... | |
auto | old_value () const noexcept |
Returns the previous revision of the value. More... | |
auto | value (bool old) const noexcept |
Returns the current or previous revision of the value. More... | |
operator T () const noexcept | |
Returns the current revision of the value. More... | |
auto | delta () const noexcept |
Returns the difference between the current and the previous revision. | |
auto | deltas () const noexcept |
Returns the differences between the adjacent revisions. | |
auto | distance () const noexcept |
Returns the distance between the current and the previous revisions. | |
auto | changed () const noexcept -> bool |
Indicates if the current and previous revisions differ. | |
template<typename U > | |
auto | as () const |
Returns this with the values cast to new type U . | |
void | sync () |
Synchronize the historic revisions to the current value. More... | |
Class for mutable variables with history.
T | the type of the value |
N | the number of latest historical revisions of the stored value. |