#include <userver/utils/expected.hpp>
For holding a value or an error.
Definition at line 56 of file 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. | |
| operator bool () 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. | |
| S && | value () && |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| const S & | value () const & |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
| E & | error () |
| Return reference to the error value or throws bad_expected_access if it's not available. | |
| const E & | error () const |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
Definition at line 156 of file expected.hpp.
Definition at line 161 of file expected.hpp.
Definition at line 166 of file expected.hpp.
| utils::expected< S, E >::expected | ( | const unexpected< E > & | error | ) |
Definition at line 171 of file expected.hpp.
| utils::expected< S, E >::expected | ( | unexpected< E > && | error | ) |
Definition at line 176 of file expected.hpp.
| utils::expected< S, E >::expected | ( | const unexpected< G > & | error | ) |
Definition at line 182 of file expected.hpp.
| utils::expected< S, E >::expected | ( | unexpected< G > && | error | ) |
Definition at line 188 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 226 of file expected.hpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 235 of file expected.hpp.
Check whether *this contains an expected value.
Definition at line 193 of file expected.hpp.
|
explicitnoexcept |
Check whether *this contains an expected value.
Definition at line 198 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 203 of file expected.hpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 212 of file expected.hpp.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Definition at line 217 of file expected.hpp.