CAF 0.17.6
|
Represents the result of a computation which can either complete successfully with an instance of type T
or fail with an error
.
More...
#include <expected.hpp>
Public Types | |
using | value_type = T |
Public Member Functions | |
template<class U > | |
expected (U x, typename std::enable_if< std::is_convertible< U, T >::value >::type *=nullptr) | |
expected (T &&x) noexcept(nothrow_move) | |
expected (const T &x) noexcept(nothrow_copy) | |
expected (caf::error e) noexcept | |
expected (no_error_t) noexcept | |
expected (const expected &other) noexcept(nothrow_copy) | |
template<class Code , class = enable_if_can_construct_error_t<Code>> | |
expected (Code code) | |
expected (expected &&other) noexcept(nothrow_move) | |
expected & | operator= (const expected &other) noexcept(nothrow_copy) |
expected & | operator= (expected &&other) noexcept(nothrow_move) |
expected & | operator= (const T &x) noexcept(nothrow_copy) |
expected & | operator= (T &&x) noexcept(nothrow_move) |
template<class U > | |
std::enable_if< std::is_convertible< U, T >::value, expected & >::type | operator= (U x) |
expected & | operator= (caf::error e) noexcept |
template<class Code > | |
enable_if_can_construct_error_t< Code, expected & > | operator= (Code code) |
T & | value () noexcept |
Returns the contained value. More... | |
T & | operator* () noexcept |
Returns the contained value. More... | |
T * | operator-> () noexcept |
Returns the contained value. More... | |
caf::error & | error () noexcept |
Returns the contained error. More... | |
const T & | cvalue () const noexcept |
Returns the contained value. More... | |
const T & | value () const noexcept |
Returns the contained value. More... | |
const T & | operator* () const noexcept |
Returns the contained value. More... | |
const T * | operator-> () const noexcept |
Returns the contained value. More... | |
operator bool () const noexcept | |
Returns true if the object holds a value (is engaged). More... | |
bool | engaged () const noexcept |
Returns true if the object holds a value (is engaged). | |
const caf::error & | cerror () const noexcept |
Returns the contained error. More... | |
const caf::error & | error () const noexcept |
Returns the contained error. More... | |
Static Public Attributes | |
static constexpr bool | nothrow_move |
Stores whether move construct and move assign never throw. More... | |
static constexpr bool | nothrow_copy |
Stores whether copy construct and copy assign never throw. More... | |
Related Functions | |
(Note that these are not member functions.) | |
constexpr no_error_t | no_error = no_error_t{} |
The only instance of ::no_error_t. | |
template<class T > | |
auto | operator== (const expected< T > &x, const expected< T > &y) -> decltype(*x==*y) |
template<class T , class U > | |
auto | operator== (const expected< T > &x, const U &y) -> decltype(*x==y) |
template<class T , class U > | |
auto | operator== (const T &x, const expected< U > &y) -> decltype(x==*y) |
template<class T > | |
bool | operator== (const expected< T > &x, const error &y) |
template<class T > | |
bool | operator== (const error &x, const expected< T > &y) |
template<class T , class E > | |
enable_if_has_make_error_t< E, bool > | operator== (const expected< T > &x, E y) |
template<class T , class E > | |
enable_if_has_make_error_t< E, bool > | operator== (E x, const expected< T > &y) |
template<class T > | |
auto | operator!= (const expected< T > &x, const expected< T > &y) -> decltype(*x==*y) |
template<class T , class U > | |
auto | operator!= (const expected< T > &x, const U &y) -> decltype(*x==y) |
template<class T , class U > | |
auto | operator!= (const T &x, const expected< U > &y) -> decltype(x==*y) |
template<class T > | |
bool | operator!= (const expected< T > &x, const error &y) |
template<class T > | |
bool | operator!= (const error &x, const expected< T > &y) |
template<class T , class E > | |
enable_if_has_make_error_t< E, bool > | operator!= (const expected< T > &x, E y) |
template<class T , class E > | |
enable_if_has_make_error_t< E, bool > | operator!= (E x, const expected< T > &y) |
bool | operator== (const expected< void > &x, const expected< void > &y) |
bool | operator!= (const expected< void > &x, const expected< void > &y) |
Represents the result of a computation which can either complete successfully with an instance of type T
or fail with an error
.
T | The type of the result. |
|
noexcept |
Returns the contained error.
engaged() == false
.
|
noexcept |
Returns the contained value.
engaged() == true
.
|
noexcept |
Returns the contained error.
engaged() == false
.
|
noexcept |
Returns the contained error.
engaged() == false
.
|
explicitnoexcept |
Returns true
if the object holds a value (is engaged).
|
noexcept |
Returns the contained value.
engaged() == true
.
|
noexcept |
Returns the contained value.
engaged() == true
.
|
noexcept |
Returns the contained value.
engaged() == true
.
|
noexcept |
Returns the contained value.
engaged() == true
.
|
noexcept |
Returns the contained value.
engaged() == true
.
|
noexcept |
Returns the contained value.
engaged() == true
.
|
staticconstexpr |
Stores whether copy construct and copy assign never throw.
|
staticconstexpr |
Stores whether move construct and move assign never throw.