Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
Prev Up HomeNext

BOOST_OUTCOME_TRYV2(spec, expr)

Evaluate an expression which results in a type matching the following customisation points, continuing execution if successful, immediately returning try_operation_return_as(X) from the calling function if unsuccessful:

Default overloads for these customisation points are provided. See the recipe for supporting foreign input to BOOST_OUTCOME_TRY.

Hints are given to the compiler that the expression will be successful. If you expect failure, you should use BOOST_OUTCOME_TRYV2_FAILURE_LIKELY(spec, expr) instead.

Overridable: Not overridable.

Definition: Firstly the expression’s temporary is bound to a uniquely named, stack allocated, spec. If that reference’s bound object’s try_operation_has_value() is false, immediately execute return try_operation_return_as(propagated unique reference);, propagating the rvalue/lvalue/etc-ness of the original expression.

Header: <boost/outcome/try.hpp>

Last revised: February 12, 2021 at 20:25:43 UTC


Prev Up HomeNext