#include <expect.h>
|
| std::error_code | code_ |
| std::aligned_storage< sizeof(void), alignof(void)>::type | storage_ |
◆ error_type
| using expect< void >::error_type = std::error_code |
◆ value_type
| using expect< void >::value_type = void |
◆ expect() [1/3]
| *Create a successful object expect< void >::expect |
( |
| ) |
|
|
inlinenoexcept |
◆ expect() [2/3]
◆ expect() [3/3]
◆ ~expect()
◆ equal()
- Note
- This function is noexcept when U == T is noexcept.
- Returns
- True if has_value() == rhs.has_value() and if values or errors are equal.
◆ error() [1/2]
| *return expect< void >::error |
( |
| ) |
|
◆ error() [2/2]
| *return Error alway std::error_code expect< void >::error |
( |
| ) |
const |
|
inlinenoexcept |
◆ get()
| void & expect< void >::get |
( |
| ) |
|
|
inlineprivatenoexcept |
◆ has_error()
| *return True if this is storing an error instead of a value bool expect< void >::has_error |
( |
| ) |
const |
|
inlinenoexcept |
◆ has_value()
| *return pre expect< void >::has_value |
( |
| ) |
->() noexcept |
|
inline |
◆ is_convertible()
| constexpr bool expect< void >::is_convertible |
( |
| ) |
|
|
inlinestaticconstexprprivatenoexcept |
◆ maybe_throw()
| void expect< void >::maybe_throw |
( |
| ) |
const |
|
inlineprivate |
◆ operator bool()
| *return True if this is storing a value instead of an error expect< void >::operator bool |
( |
| ) |
const |
|
inlineexplicitnoexcept |
◆ operator=()
◆ store()
| void expect< void >::store |
( |
U && | value | ) |
|
|
inlineprivatenoexcept |
◆ value()
| void && expect< void >::value |
( |
| ) |
&& |
|
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.
◆ code_
| std::error_code expect< void >::code_ |
|
private |
◆ storage_
| std::aligned_storage<sizeof(void),alignof(void)>::type expect< void >::storage_ |
|
private |
◆ Value
The documentation for this class was generated from the following file: