Template Class Computed
Defined in File Reactivity.hpp
Inheritance Relationships
Base Type
public Cacao::Reactivity::Dependency(Class Dependency)
Class Documentation
-
template<astra::Serializable T>
class Computed : public Cacao::Reactivity::Dependency A piece of state whose value is computed when needed and cached between updates.
Public Functions
-
inline Computed(std::initializer_list<Dependency*> inputs, std::function<T(void)> evaluator)
Create a new piece of computed state from a source.
- Parameters:
inputs – The dependencies that should trigger a re-evaluation of the value; only these values can be accessed during computation
evaluator – The function to perform the evaluation
-
inline operator const T&() const
Get the current value.
- Returns:
The current held value
-
inline const T *operator->() const
Access the current value in a read-only manner.
-
inline Computed(std::initializer_list<Dependency*> inputs, std::function<T(void)> evaluator)