Graphviz 13.0.0~dev.20250308.2027
|
C analog of C++’s std::optional
More...
#include <assert.h>
#include <stdbool.h>
#include <stddef.h>
Go to the source code of this file.
Data Structures | |
struct | optional_double_t |
a container that may or may not contain a double value More... | |
Functions | |
static void | optional_double_set (optional_double_t *me, double value) |
static double | optional_double_value_or (optional_double_t me, double fallback) |
|
inlinestatic |
set the value of an optional
This utility function is intended to avoid the easy typo of setting the value while forgetting to set the has_value
member.
me | The optional whose value to set |
value | The value to assign |
Definition at line 23 of file optional.h.
References optional_double_t::has_value, NULL, and optional_double_t::value.
Referenced by svg_size().
|
inlinestatic |
get the value of an optional or a given value if the optional is empty
me | The optional whose value to retrieve |
fallback | The value to return if the optional is empty |
fallback
if it was empty Definition at line 34 of file optional.h.
References optional_double_t::has_value, and optional_double_t::value.
Referenced by svg_size().