template<typename T>
GGUI::GGState class

GGState<T>: a value that lives with an element and survives re-runs.

auto bOpen = ui.State<bool>(false);
ui.Button(bOpen.Get() ? "Hide" : "Show", [bOpen] { bOpen.Set(!bOpen.Get()); });

Setting a different value re-runs the declaring component on the next update. The handle is small and trivially copyable, so handlers capture it by value. It goes stale with its element: Get then returns a default T and Set does nothing.

Public static variables

static bool bPlain constexpr
Small trivially-copyable values are stored inline with the element; anything else in its own block, freed with the element.

Public functions

auto Get() const -> T
The value; a default T if its element is gone.
void Set(const T& value) const
Set the value. A different value runs the declaring component again; nothing if its element is gone.