Define TRY

Define Documentation

TRY(expected)

Unwrap an expected into a stack variable or return the unexpected value.

This macro requires the use of non-standard C++. Compiler extensions must be enabled and -Wpedantic cannot be used. With GCC and Clang, you can disable -Wpedantic for an entire translation unit like this:

#pragma GCC diagnostic ignored "-Wpedantic"

You can disable -Wpedantic for a specific segment of code like so:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
//...
#pragma GCC diagnostic pop

For more information on this particular compiler extension go to https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html