|
Uni20
Asynchronous tensor and runtime library.
|
A simple yes/no toggle that parses from a string. More...
#include <terminal.hpp>
Public Member Functions | |
| operator bool () const | |
| Implicit conversion to bool. | |
| toggle (bool value_) | |
| toggle (std::string_view str, bool default_value=true) | |
| Construct from a string (e.g. | |
Public Attributes | |
| bool | value |
A simple yes/no toggle that parses from a string.
Accepts "yes", "true", "1" (case-insensitive) as true, and "no", "false", "0" as false. An empty string or unregognised value returns the default_value, which itself defaults to true.
|
inline |
|
inline |
Construct from a string (e.g.
from an env var).
| str | The string to interpret. |
| default_value | Used if the string is empty or not recognized. |
|
inline |
Implicit conversion to bool.
| bool terminal::toggle::value |