38 template<
class T,
class E>
62 template<
class... Args>
65 return {
new value_type(std::forward<Args>(args)...),
nullptr };
79 template<
class... Args>
82 return {
nullptr,
new error_type(std::forward<Args>(args)...) };
89 : m_value(that.m_value ? new
value_type(*that.m_value) : nullptr)
90 , m_error(that.m_error ? new
error_type(*that.m_error) : nullptr) {}
96 : m_value(std::move(that.m_value))
97 , m_error(std::move(that.m_error))
99 that.m_value =
nullptr;
100 that.m_error =
nullptr;
106 template<
class U,
class G>
159 template<
class U,
class G>
197 m_value = std::move(that.m_value);
198 m_error = std::move(that.m_error);
199 that.m_value =
nullptr;
200 that.m_error =
nullptr;
219 inline constexpr explicit operator bool() const noexcept
314 :
static_cast<value_type>(std::forward<U>(default_value));
325 ?
static_cast<error_type>(std::forward<U>(default_error))
341 return *m_value == *that.m_value;
348 return *m_error == *that.m_error;
370 template<
class U,
class G>
380 return *m_value == that.
value();
387 return *m_error == that.
error();
393 template<
class U,
class G>
402 template<
class U,
class G>
constexpr const error_type & error() const noexcept
Definition result.hpp:300
static result< T, E > error(const error_type &error)
Definition result.hpp:71
error_type error_or(U &&default_error) const
Definition result.hpp:322
bool operator!=(const result &that) const
Definition result.hpp:362
bool operator!=(const result< U, G > &that) const
Definition result.hpp:403
result & operator=(const result< U, G > &that)
Definition result.hpp:160
bool operator==(const result &that) const
Definition result.hpp:354
result & operator=(const result &that)
Definition result.hpp:129
constexpr value_type & value() noexcept
Definition result.hpp:237
value_type value_or(U &&default_value) const
Definition result.hpp:310
result(result &&that)
Definition result.hpp:95
constexpr const value_type & operator*() const noexcept
Definition result.hpp:282
bool equals(const result< U, G > &that) const
Definition result.hpp:371
result & operator=(result &&that)
Definition result.hpp:185
~result()
Definition result.hpp:114
result(value_type &&value)
Definition result.hpp:55
constexpr const value_type * operator->() const noexcept
Definition result.hpp:264
result(const result< U, G > &that)
Definition result.hpp:107
static result< T, E > error(Args &&... args)
Definition result.hpp:80
constexpr error_type & error() noexcept
Definition result.hpp:291
result(const result &that)
Definition result.hpp:88
E error_type
Definition result.hpp:43
constexpr bool has_value() const noexcept
Definition result.hpp:210
static result< T, E > ok(Args &&... args)
Definition result.hpp:63
constexpr value_type & operator*() noexcept
Definition result.hpp:273
constexpr bool operator!() const noexcept
Definition result.hpp:228
result(const value_type &value)
Definition result.hpp:48
T value_type
Definition result.hpp:42
bool equals(const result &that) const
Definition result.hpp:332
const value_type & value() const noexcept
Definition result.hpp:246
constexpr value_type * operator->() noexcept
Definition result.hpp:255
bool operator==(const result< U, G > &that) const
Definition result.hpp:394