Lumiera
0.pre.03
»edit your freedom«
|
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/wrapper.hpp"
#include "lib/meta/util.hpp"
#include "lib/null-value.hpp"
#include <type_traits>
#include <exception>
#include <utility>
Classes | |
class | Result< RES > |
Representation of the result of some operation, EITHER a value or a failure. More... | |
class | Result< RES > |
Representation of the result of some operation, EITHER a value or a failure. More... | |
class | Result< void > |
The base case is just to capture success or failure, without returning any value result. More... | |
Functions | |
template<class FUN , typename... ARGS> | |
auto | failsafeInvoke (std::exception_ptr &capturedFailure, FUN &&callable, ARGS &&...args) noexcept |
Helper to invoke an arbitrary callable in a failsafe way. More... | |
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. More... | |
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. More... | |
Namespaces | |
lib | |
Implementation namespace for support and library code. | |