For holding a value or an error. More...
#include <userver/utils/expected.hpp>
Public Member Functions | |
expected (const S &success) | |
expected (S &&success) | |
expected (const unexpected< E > &error) | |
expected (unexpected< E > &&error) | |
template<class G , typename = std::enable_if_t<std::is_convertible_v<G, E>>> | |
expected (const unexpected< G > &error) | |
template<class G , typename = std::enable_if_t<std::is_convertible_v<G, E>>> | |
expected (unexpected< G > &&error) | |
bool | has_value () const noexcept |
Check whether *this contains an expected value. | |
S & | value () |
Return reference to the value or throws bad_expected_access if it's not available. | |
const S & | value () const |
E & | error () |
Return reference to the error value or throws bad_expected_access if it's not available. | |
const E & | error () const |
For holding a value or an error.
Definition at line 53 of file expected.hpp.
Definition at line 114 of file expected.hpp.
Definition at line 117 of file expected.hpp.
utils::expected< S, E >::expected | ( | const unexpected< E > & | error | ) |
Definition at line 120 of file expected.hpp.
utils::expected< S, E >::expected | ( | unexpected< E > && | error | ) |
Definition at line 123 of file expected.hpp.
utils::expected< S, E >::expected | ( | const unexpected< G > & | error | ) |
Definition at line 128 of file expected.hpp.
utils::expected< S, E >::expected | ( | unexpected< G > && | error | ) |
Definition at line 133 of file expected.hpp.
Return reference to the error value or throws bad_expected_access if it's not available.
utils::bad_expected_access | if success value is not available |
Definition at line 162 of file expected.hpp.
Definition at line 172 of file expected.hpp.
Check whether *this contains an expected value.
Definition at line 137 of file expected.hpp.
Return reference to the value or throws bad_expected_access if it's not available.
utils::bad_expected_access | if *this contain an unexpected value |
Definition at line 142 of file expected.hpp.
Definition at line 152 of file expected.hpp.