A value, an error (std::exception_ptr), or a "stopped"/cancellation state.
Declared in <folly/result/result.h>
template<typename T = void>
class [[nodiscard]] result final
: public /* implementation-defined */
The default specialization is non-void (but result<> defaults to void).
| Name | Description |
|---|---|
/* implementation-defined */ |
| Name | Description |
|---|---|
promise_type | * Protocols * |
value_type |
| Name | Description |
|---|---|
result [constructor] | Constructors |
~result [destructor] | Destroys the stored value when in the value state. |
operator= | Assignment operators |
copy [deprecated] | result<T> is copyable iff T is copyable. |
error_or_stopped | Error-or-stopped access should be used SPARINGLY! |
get_exception | |
get_mutable_exception | |
get_pointer | get_pointer overloads |
has_stopped | |
has_value | * Accessors for T void and non-void *** |
non_value | |
value_or_throw | value_or_throw overloads |
| Name | Description |
|---|---|
value_ [variant member] | Stored value or reference wrapper; valid only in the value state. |
| Name |
|---|
has_value_sigil_t |
storage_type |
| Name |
|---|
operator= [deleted] |
throw_if_no_value |
| Name |
|---|
rewrapping_result_convert |
| Name |
|---|
eos_ |
| Name | Description |
|---|---|
result<void> | Specialization for T = void aka result<>. Uses no value_ storage. |
| Name | Description |
|---|---|
result<T&> | Deduction guide: std::reference_wrapper<T> yields result<T&>. |
result<T&&> | Deduction guide: rvalue_reference_wrapper<T> yields result<T&&>. |
| Name | Description |
|---|---|
folly::operator== | Compares two result values for equality. |
folly::result | A value, an error (std::exception_ptr), or a "stopped"/cancellation state. |
| Name | Description |
|---|---|
epitaph | Annotates the error state of a result<T> with an epitaph message. |
or_unwind_epitaph | or_unwind_epitaph |
result_to_try | Converts a result<T> to a Try<T>. |
stack_epitaph | Annotates the error state of a result<T> with a stack-trace epitaph. |
try_to_result | If t is empty, defaults to returning a UsingUninitializedTry result. Pick your own default via empty_try_with{ { return result<T>{...}; }. |
try_to_result | Converts a Try<T> to a result<T>, treating empty as an error. |
The return value should not be discarded.