![]() |
Lumiera 0.pre.04
»edit your freedom«
|
Intermediary value object to represent »either« an operation result or a failure. More...
Go to the source code of this file.
Intermediary value object to represent »either« an operation result or a failure.
Some operation might have produced a value result or failed with an exception. Typically, the Result token is used inline — immediately either invoking one of the member function or employing the built-in result type conversion. It will be copyable iff the result value is copyable. There is an implicit valid or failure state, which can be tested. Any attempt to get the value of an invalid result token will cause an exception to be thrown.
Result<void>(bool) can be used as a success markerResult instance can be created by perfect forwarding from any typeDefinition in file result.hpp.
#include "lib/error.hpp"#include "lib/item-wrapper.hpp"#include "lib/meta/util.hpp"#include <type_traits>#include <exception>#include <utility>Namespaces | |
| namespace | lib |
| Implementation namespace for support and library code. | |
Classes | |
| class | Result< void > |
| The base case is just to capture success or failure, without returning any value result. More... | |
| class | Result< RES > |
| Representation of the result of some operation, EITHER a value or a failure. More... | |
Functions | |
| template<typename VAL , typename = lib::meta::disable_if<std::is_invocable<VAL>>> | |
| Result (VAL &&) -> Result< VAL > | |
| deduction guide: allow perfect forwarding of a any result into the ctor call. | |
| template<typename FUN , typename... ARGS> | |
| Result (FUN &&, ARGS &&...) -> Result< std::invoke_result_t< FUN, ARGS... > > | |
| deduction guide: find out about result value to capture from a generic callable. | |