Live Cells C++
Reactive Programming for C++
|
Container holding a cell value or an exception that occurred while computing a value. More...
#include <maybe.hpp>
Public Member Functions | |
maybe () | |
Create a container holding an uninitialized_cell_error exception. | |
maybe (const T &val) | |
Create a container holding a value. | |
maybe (std::exception_ptr error) | |
Create a container holding an exception that was thrown. | |
T | unwrap () const |
Get the value or throw the exception stored in this container. | |
std::optional< T > | value () const |
Get the value held in this. | |
std::exception_ptr | error () const |
Get the exception held in this maybe. | |
Static Public Member Functions | |
static maybe< T > | error (const auto &error) |
Create a container holding an exception that was thrown. | |
static maybe< T > | wrap (const std::invocable auto &f) |
Create a maybe holding the result of calling f. | |
Container holding a cell value or an exception that occurred while computing a value.
|
inline |
Create a container holding a value.
val | The value |
|
inline |
Create a container holding an exception that was thrown.
error | The exception that was thrown. |
|
inline |
Get the exception held in this maybe.
|
inlinestatic |
Create a container holding an exception that was thrown.
std::exception_ptr
.error | The exception that was thrown. |
maybe
holding an exception.
|
inline |
Get the value or throw the exception stored in this container.
|
inline |
Get the value held in this.
std::bad_optional_access | If the maybe does not hold a value. |
|
inlinestatic |
Create a maybe
holding the result of calling f.
f is called with no arguments. If it returns normally, the resulting maybe
holds the returned value. If f throws an exception the resulting maybe holds the thrown exception.
A | function of no arguments. |
maybe
holding the result of calling f.