|
typedef void | ok_type |
|
typedef E | err_type |
|
|
| result (internal::placeholder, E &&value) |
|
| result (internal::placeholder, const E &value) |
|
| result (E &&value) |
|
| result (const E &value) |
|
bool | is_ok () const noexcept |
|
bool | is_err () const noexcept |
|
| operator bool () const noexcept |
|
void | ok_value () |
|
constexpr E const & | err_value () const & |
|
constexpr E & | err_value ()& |
|
constexpr E && | err_value ()&& |
|
template<class V > |
constexpr E | err_value_or (V &&v) const & |
|
template<class V > |
constexpr E | err_value_or (V &&v)&& |
|
template<typename F > |
auto | map (F f) noexcept-> maybe::result< typename std::result_of< F()>::type, E > |
|
template<typename U > |
auto | map_value (U value) noexcept-> maybe::result< U, E > |
|
template<typename F > |
auto | map_err (F f) noexcept-> maybe::result< void, typename std::result_of< F(E)>::type > |
|
template<typename U > |
auto | map_err_value (U value) noexcept-> maybe::result< void, U > |
|
template<typename F > |
auto | and_then (F op) noexcept-> typename std::result_of< F()>::type |
|
auto | into_err () noexcept-> maybe::result< void, E > |
|
|
static constexpr result< void, E > | ok () noexcept |
|
static constexpr result< void, E > | err (E &&value) noexcept |
|
static constexpr result< void, E > | err (const E &value) noexcept |
|
static constexpr result< void, E > | default_ok () noexcept |
|
static constexpr result< void, E > | default_err () noexcept |
|
template<typename E>
class maybe::result< void, E >
Definition at line 315 of file result.hpp.
template<typename E >
template<typename F >
auto maybe::result< void, E >::and_then |
( |
F |
op | ) |
-> typename std::result_of<F()>::type |
|
inlinenoexcept |
Calls op if the result is ok, otherwise returns the err value of self.
This function can be used for control flow based on result values.
- Parameters
-
f | F() -> maybe::result<U, E> |
- Returns
- maybe::result<U, E>
Definition at line 143 of file result.inline.hpp.
References maybe::result< T, E >::err().
Check if result contains err value.
- Returns
- bool
Definition at line 407 of file result.hpp.
Check if result contains ok value.
- Returns
- bool
Definition at line 397 of file result.hpp.
template<typename E >
template<typename F >
Maps a result<void, E> to result<U, E> (where U is return value of F(void)) by applying a function F to a contained ok value, leaving an err value untouched.
This function can be used to compose the results of two functions.
- Parameters
-
- Returns
- maybe::result<U, E>
Definition at line 95 of file result.inline.hpp.
template<typename E >
template<typename F >
Maps a result<void, E> to result<void, U> (where U is return value of F(E)) by applying a function to a function to a contained err value, leaving an ok value untouched.
This function can be used to pass through a successful result while changing an error.
- Parameters
-
- Returns
- maybe::result<void, U>
Definition at line 119 of file result.inline.hpp.
template<typename E >
template<typename U >
Maps a result<void, E> to result<void, U> by always returning provided U value on error, leaving an ok value untouched.
This function can be used to compose the results of two functions.
- Parameters
-
- Returns
- maybe::result<void, U>
Definition at line 132 of file result.inline.hpp.
References maybe::result< T, E >::ok().
template<typename E >
template<typename U >
Maps a result<void, E> to result<U, E> by always returning provided U value on success, leaving an err value untouched.
This function can be used to compose the results of two functions.
- Parameters
-
- Returns
- maybe::result<U, E>
Definition at line 108 of file result.inline.hpp.
References maybe::result< T, E >::err().
The documentation for this class was generated from the following files: