ZenitUI
Retained-mode C++20 UI framework
Loading...
Searching...
No Matches
ZenitUI::Opt< T > Struct Template Reference

Optional wrapper with value semantics used for all style fields. More...

#include <Style.hpp>

Public Member Functions

 Opt (const T &v)
 Opt (T &&v)
Opt & operator= (const T &v)
Opt & operator= (T &&v)
void reset ()
T get_or (const T &fallback) const

Public Attributes

T value {}
bool is_set {false}

Detailed Description

template<typename T>
struct ZenitUI::Opt< T >

Optional wrapper with value semantics used for all style fields.

Unlike std::optional, Opt<T> stores the value inline and is cheap to copy even for large T. The is_set flag distinguishes "not declared" from "declared to the default". This distinction is what allows the stylesheet cascade to work without a separate presence bitmask.


The documentation for this struct was generated from the following file: