|
Electroneum
|
#include <expect.h>
Public Types | |
| using | value_type = void |
| using | error_type = std::error_code |
Public Member Functions | |
| *Create a successful object | expect () noexcept |
| expect (std::error_code const &code) noexcept | |
| expect (expect const &)=default | |
| ~expect ()=default | |
| expect & | operator= (expect const &)=default |
| *return True if this is storing a value instead of an error | operator bool () const noexcept |
| *return True if this is storing an error instead of a value bool | has_error () const noexcept |
| *return Error alway std::error_code | error () const noexcept |
| *return | error () |
| void && | value () && |
| *return pre | has_value ()`. void *operator->() noexcept |
| bool | equal (expect< U > const &rhs) const noexcept(noexcept(*std::declval< expect< void > >()==*rhs)) |
Public Attributes | |
| *return | Value |
|
inlinenoexcept |
Definition at line 357 of file expect.h.

Definition at line 314 of file expect.h.
| *return expect< void >::error | ( | ) |

|
inlinenoexcept |
|
inline |

|
inline |
Move src into this. If src.has_value() && addressof(src) != this then src.value() will be in a "moved from state". */ expect& operator=(expect&& src) noexcept(std::is_nothrow_move_constructible<T>() && std::is_nothrow_move_assignable<T>()) { if (this != std::addressof(src)) { if (has_value() && src.has_value()) get() = std::move(src.get()); else if (has_value()) get().~T(); else if (src.has_value()) store(std::move(src.get())); code_ = src.error(); } return *this; } @iverbatim \return True if this is storing a value instead of an error. @endiverbatim\ilinebr explicit operator bool() const noexcept { return has_value(); } @iverbatim \return True if this is storing an error instead of a value. @endiverbatim\ilinebr bool has_error() const noexcept { return bool(code_); } @iverbatim \return True if this is storing a value instead of an error. @endiverbatim\ilinebr bool has_value() const noexcept { return !has_error(); } @iverbatim \return Error - always safe to call. Empty when !has_error(). @endiverbatim\ilinebr std::error_code error() const noexcept { return code_; } @iverbatim \return Value if has_value() otherwise \throw std::system_error{error()}. @endiverbatim\ilinebr T& value() & { maybe_throw(); return get(); } @iverbatim \return Value if has_value() otherwise \throw std::system_error{error()}`. T const& value() const & { maybe_throw(); return get(); }
/*! Same as other overloads, but expressions such as foo(bar().value()) will automatically perform moves with no copies.