Evaluate an expression which results in a type matching the following customisation points, emitting the
T if successful, immediately returning
from the calling function if unsuccessful:
Default overloads for these customisation points are provided. See the recipe for supporting foreign input to
Availability: GCC and clang only. Use
#ifdef OUTCOME_TRYX to determine if available.
Overridable: Not overridable.
for most of the mechanics.
This macro makes use of a proprietary extension in GCC and clang to emit the
T from a successful expression. You can thus use
OUTCOME_TRYX(expr) directly in expressions e.g.
auto x = y + OUTCOME_TRYX(foo(z));.
Be aware there are compiler quirks in preserving the rvalue/lvalue/etc-ness of emitted
T’s, specifically copy or move constructors may be called unexpectedly and/or copy elision not work as expected. If these prove to be problematic, use