For holding a value or an error.
Definition in file expected.hpp.
Go to the source code of this file.
#include <concepts>#include <stdexcept>#include <string>#include <utility>#include <variant>#include <userver/compiler/impl/lifetime.hpp>#include <userver/utils/assert.hpp>Classes | |
| class | utils::bad_expected_access |
| class | utils::unexpected< E > |
| class | utils::expected< S, E > |
| For holding a value or an error. More... | |
| class | utils::expected< void, E > |
Namespaces | |
| namespace | utils |
| General-purpose utilities used across userver libraries. | |
Functions | |
| template<class E> | |
| utils::unexpected (E) -> unexpected< E > | |
| template<class S, class E> requires std::equality_comparable<S> && std::equality_comparable<E> | |
| bool | utils::operator== (const expected< S, E > &lhs, const expected< S, E > &rhs) |
| Compares two utils::expected: equal either if both hold equal values, or if both hold equal errors. | |
| template<class S, class E, class T> requires (!std::same_as<T, expected<S, E>>) && std::equality_comparable_with<S, T> | |
| bool | utils::operator== (const expected< S, E > &lhs, const T &rhs) |
| Compares utils::expected with a value: equal if lhs holds a value equal to rhs. | |
| template<class S, class E, class G> requires std::equality_comparable_with<E, G> | |
| bool | utils::operator== (const expected< S, E > &lhs, const unexpected< G > &rhs) |
| Compares utils::expected with utils::unexpected: equal if lhs holds an error equal to rhs.error(). | |
| template<class E> requires std::equality_comparable<E> | |
| bool | utils::operator== (const expected< void, E > &lhs, const expected< void, E > &rhs) |
| Compares two utils::expected<void, E>: equal either if both hold a value, or if both hold equal errors. | |
| template<class E, class G> requires std::equality_comparable_with<E, G> | |
| bool | utils::operator== (const expected< void, E > &lhs, const unexpected< G > &rhs) |
| Compares utils::expected<void, E> with utils::unexpected: equal if lhs holds an error equal to rhs.error(). | |