The file that defines the Result class and the TRY and MUST macros.
More...
#include <cassert>
#include <optional>
#include <variant>
Go to the source code of this file.
|
#define | TRY(expr) |
|
#define | MUST(expr) |
|
The file that defines the Result class and the TRY and MUST macros.
◆ MUST
Value: ({ \
auto _tmp = (expr); \
assert(_tmp.is_value()); \
_tmp.release_value(); \
})
A macro that is used to check the result of an expression that returns a Result object. If the result is an error, it will assert, otherwise it will return the value.
- Template Parameters
-
expr | The expression that returns a Result object. |
◆ TRY
Value: ({ \
auto _tmp = (expr); \
if (_tmp.is_error()) \
return _tmp.release_error(); \
_tmp.release_value(); \
})
A macro that is used to check the result of an expression that returns a Result object. If the result is an error, it will return the error, otherwise it will return the value.
- Template Parameters
-
expr | The expression that returns a Result object. |