result
| Type | Class |
| Namespace | conjure::core |
| Include File Path | engine/include/conjure/core/result.h |
| Source File Path | N/A |
| API ↗ | Errors and results |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | result(
const ValueType &value); | |
| public | result(
ValueType &&value) noexcept(std::is_nothrow_move_constructible_v<ValueType>); | |
| public | result(
error failure) noexcept; | |
| public | result(
const result &) = default; | |
| public | result(
result &&) noexcept = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~result() = default; |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mStorage | std:: | — |
Functions
Public
get_error
get_error[[nodiscard]] const error &get_error() const & noexcept;The held error. Calling this on a value result is a fatal programmer error.
[[nodiscard]] error &&get_error() && noexcept;has_value
has_value[[nodiscard]] bool has_value() const noexcept;True when this result holds a value rather than an error.
value
value[[nodiscard]] ValueType &value() & noexcept;The held value. Calling this on an error result is a fatal programmer error.
[[nodiscard]] const ValueType &value() const & noexcept;[[nodiscard]] ValueType &&value() && noexcept;value_or
value_ortemplate <typename FallbackType> [[nodiscard]] ValueType value_or(
FallbackType &&fallback) const &;The value, or fallback when this result holds an error.
template <typename FallbackType> [[nodiscard]] ValueType value_or(
FallbackType &&fallback) &&;Operator Overloads
Public
operator bool
operator bool[[nodiscard]] explicit operator bool() const noexcept;operator*
operator*[[nodiscard]] ValueType &operator*() & noexcept;[[nodiscard]] const ValueType &operator*() const & noexcept;[[nodiscard]] ValueType &&operator*() && noexcept;operator->
operator->[[nodiscard]] ValueType *operator->() noexcept;[[nodiscard]] const ValueType *operator->() const noexcept;