Outcome provides multiple methods for user code to intercept various events which occur.
The deepest is simply to inherit from
outcome and override member functions,
for which you will need to study the source code as that form of customisation is out of scope for this tutorial.
Another option is to supply a custom
NoValuePolicy (see next section).
The final option, which this section covers, is to use the ADL discovered event hooks
which tell you when a namespace-localised
result has been:
One criticism often levelled against these success-or-failure objects is that they do
not provide as rich a set of facilities as C++ exception throws. This section shows
you how to configure Outcome using the ADL event hooks to take a stack backtrace on
construction of an errored
and if that
result<T, error_code> should ever be converted into an
outcome<T, error_code, std::exception_ptr>,
std::exception_ptr will be just-in-time synthesised consisting of the
for the error code, plus an expanded message string containing the stack backtrace of where
the error originally occurred. One can see the use case for fixed latency code being built
result, and it dovetailing into application code where execution time guarantees are
not important where a
malloc is permitted.