A wrapper that contains either an instance of T, an exception, or nothing.
Synopsis
Declared in <folly/Try.h>
template<class T>
class Try;
Description
Exceptions are stored as exception_wrapper`s so that the user can minimize rethrows if so desired. To represent success or a captured exception, use `Try<Unit>.
Type Aliases
Name |
Description |
The value type for the |
Member Functions
Name |
Description |
In‐place construct the value in the |
|
In‐place construct an exception in the |
|
|
|
|
|
|
|
Check whether the |
|
Dereference operators |
|
Member access operators |
|
|
Rethrow if the |
Rethrow if the |
|
|
|
|
|
Return the contained value, or a fallback if there is none. |
|
|
Using Declarations
Name |
Specializations
Name |
Description |
Specialization of |
Deduction Guides
Name |
Description |
Deduction guide that deduces the value type of a |
Non-Member Functions
Name |
Description |
Execute a function and capture its result as a |
|
Execute a function and capture its result as a |
|
Converts a |
|
Try to move the value/exception from another |
|
Try to in‐place construct a new value from the specified arguments. |
|
Try to in‐place construct a new value from the result of a function. |
|
If |
|
Converts a |
|
Make a Task out of a Try. |
|
Await an async‐annotated functor, capturing its result or exception in a Try. |
|
Convert a Try into an Async result, rethrowing any stored exception. |
Created with MrDocs