|
ZenitUI
Retained-mode C++20 UI framework
|
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} |
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.