vecs
Fast, flexible ecs in C++ with ergonomic API
|
Provides an interface for interacting with optional components. More...
#include <vecs.h>
Public Types | |
using | value_type = T |
Public Member Functions | |
Optional () | |
Constructs an empty Optional with no value. | |
Optional (T *ptr) | |
Constructs an Optional that holds a pointer to a value. | |
operator bool () const | |
Checks if the Optional contains a value. | |
T & | operator* () const |
Dereferences the contained value. | |
T & | get () const |
Returns a reference to the contained value. | |
T * | operator-> () |
T * | operator-> () const |
bool | has_value () const |
Checks if a value is present. | |
Provides an interface for interacting with optional components.
T | The type of the wrapped value. |
Example usage:
|
inlineexplicit |
Constructs an Optional that holds a pointer to a value.
ptr | A pointer to the value to be wrapped. |
|
inline |
Returns a reference to the contained value.
|
inline |
Checks if a value is present.
|
inline |
Checks if the Optional contains a value.
|
inline |
Dereferences the contained value.