ComponentFn class
#include <GGUI/Public/UITypes.h>
ComponentFn: the function a component re-runs.
Stored on the component's node. Two ComponentFns are equal when they are the same function with byte-identical captures. That is how an unchanged child is skipped when its parent re-runs: a function capturing handles and plain values is skipped until something it watches changes.
A function capturing something that owns memory is stored too but can't be compared, so it re-runs whenever its parent does. To make such a component skippable, pass its data as properties: ui.Component(&Function, properties) calls Function(ui, properties) and is skipped while the properties compare equal (ComponentFn::
Public static variables
- static size_t InlineBytes constexpr
- the most a lambda stored inline takes
Public static functions
-
template<typename TProps>static auto With(void(*)(UI&, const TProps&) function, TProps properties) -> ComponentFn
- Calls
function(ui, properties)with stored properties. Equal to another built from the same function with equal properties.
Constructors, destructors, conversion operators
- ComponentFn() defaulted
- No function.
-
template<typename TFn>ComponentFn(TFn fn)
fn, called with the UI it builds into.- operator bool() const explicit
- Whether it has a function.
Public functions
- void operator()(UI& ui) const
- Build into
ui.
Friends
- auto operator==(const ComponentFn& a, const ComponentFn& b) -> bool
- The same function with byte-identical captures, or equal properties (With).