Template Class State

Nested Relationships

Nested Types

Inheritance Relationships

Base Types

Class Documentation

template<astra::Serializable T>
class State : public Cacao::Reactivity::Dependency, public Cacao::Reactivity::EffectOutput

A source of reactive state.

Public Functions

inline State()

Create some state with no initial value.

template<typename ...Args>
inline State(Args&&... args)

Create some state with an initial value.

Parameters:

initial – The initial value to store

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 State &operator=(const T &value)

Wholly replace the currently held value with a copy of an existing object.

Parameters:

value – The new value

inline State &operator=(T &&value)

Wholly replace the currently held value with a new one.

Parameters:

value – The new value

inline MutationProxy Modify()

Modify the contents of the currently held value.

class MutationProxy

A small proxy object for controlling access to state mutation.

Public Functions

inline operator T&()

Get the current value.

Returns:

The current held value

inline T *operator->()

Access the current value in a writable manner.

inline ~MutationProxy()