CppWAMP
C++11 client library for the WAMP protocol
|
Minimalistic implementation of std::expected<T, std::error_code> More...
#include <cppwamp/erroror.hpp>
Public Types | |
using | value_type = T |
Type representing result values. | |
using | error_type = std::error_code |
Type representing errors. */. | |
using | ValueType = value_type |
Public Member Functions | |
ErrorOr ()=default | |
Default constructor. | |
ErrorOr (const ErrorOr &)=default | |
Copy contructor. | |
ErrorOr (ErrorOr &&)=default | |
Move contructor. | |
ErrorOr (value_type value) | |
Converting constructor taking a value. | |
template<typename G > | |
ErrorOr (Unexpected< G > unex) | |
Converting constructor taking an Unexpected. | |
template<typename... Args> | |
value_type & | emplace (Args &&... args) |
Initializes the value in-place using the given value constructor arguments. | |
ErrorOr & | operator= (const ErrorOr &)=default |
Copy assignment. | |
ErrorOr & | operator= (ErrorOr &&)=default |
Move assignment. | |
ErrorOr & | operator= (value_type value) |
Value assignment. | |
template<typename G > | |
ErrorOr & | operator= (Unexpected< G > unex) |
Error assignment. | |
void | swap (ErrorOr &rhs) noexcept(std::is_nothrow_swappable< value_type >::value) |
Swap contents with another instance. | |
value_type * | operator-> () |
Unchecked access of a member of the stored value. | |
const value_type * | operator-> () const |
Unchecked access of a member of the stored value. | |
value_type & | operator* () & |
Unchecked access of the stored value. More... | |
value_type && | operator* () && |
Unchecked move of the stored value. More... | |
const value_type & | operator* () const & |
Unchecked access of the stored value. More... | |
const value_type && | operator* () const && |
Unchecked move of the stored value. More... | |
operator bool () const noexcept | |
Indicates if a value is being contained. | |
bool | has_value () const noexcept |
Indicates if a value is being contained. | |
value_type & | value () & |
Checked access of the stored value. More... | |
value_type && | value () && |
Checked move of the stored value. More... | |
const value_type & | value () const & |
Checked access of the stored value. More... | |
const value_type && | value () const && |
Checked move of the stored value. More... | |
error_type & | error () |
Unchecked access of the stored error. More... | |
const error_type & | error () const |
Unchecked access of the stored error. More... | |
template<typename U > | |
value_type | value_or (U &&v) const & |
Returns the stored value if it exists, or the given fallback value. | |
template<typename U > | |
value_type | value_or (U &&v) && |
Returns the moved stored value if it exists, or the given fallback value. | |
Deprecated member functions from old AsyncReult | |
ErrorOr (std::error_code ec) | |
ErrorOr (std::error_code ec, std::string) | |
ValueType & | get () |
const ValueType & | get () const |
std::error_code | errorCode () const |
const std::string & | errorInfo () const |
ErrorOr & | setValue (T value) |
ErrorOr & | setError (std::error_code ec) |
ErrorOr & | setError (std::error_code ec, std::string) |
Related Functions | |
(Note that these are not member functions.) | |
template<typename T > | |
void | swap (ErrorOr< T > &x, ErrorOr< T > &y) noexcept(noexcept(x.swap(y))) |
Non-member swap. | |
template<typename T1 , typename T2 > | |
bool | operator== (const ErrorOr< T1 > &x, const ErrorOr< T2 > &y) |
Equality comparison with another ErrorOr. | |
template<typename T1 , typename T2 > | |
bool | operator!= (const ErrorOr< T1 > &x, const ErrorOr< T2 > &y) |
Inequality comparison with another ErrorOr. | |
template<typename T1 , typename T2 > | |
bool | operator== (const ErrorOr< T1 > &x, const T2 &v) |
Equality comparison with a value. | |
template<typename T1 , typename T2 > | |
bool | operator== (const T2 &v, const ErrorOr< T1 > &x) |
Equality comparison with a value. | |
template<typename T1 , typename T2 > | |
bool | operator!= (const ErrorOr< T1 > &x, const T2 &v) |
Inequality comparison with a value. | |
template<typename T1 , typename T2 > | |
bool | operator!= (const T2 &v, const ErrorOr< T1 > &x) |
Inequality comparison with a value. | |
template<typename T , typename E > | |
bool | operator== (const ErrorOr< T > &x, const Unexpected< E > &e) |
Equality comparison with an error. | |
template<typename T , typename E > | |
bool | operator== (const Unexpected< E > &e, const ErrorOr< T > &x) |
Equality comparison with an error. | |
template<typename T , typename E > | |
bool | operator!= (const ErrorOr< T > &x, const Unexpected< E > &e) |
Inequality comparison with an error. | |
template<typename T , typename E > | |
bool | operator!= (const Unexpected< E > &e, const ErrorOr< T > &x) |
Inequality comparison with an error. | |
Minimalistic implementation of std::expected<T, std::error_code>
T | The contained value type when there is no error. |
using wamp::ErrorOr< T >::ValueType = value_type |
|
inline |
|
inline |
|
inline |
Unchecked access of the stored value.
this->has_value() == true
|
inline |
Unchecked move of the stored value.
this->has_value() == true
|
inline |
Unchecked access of the stored value.
this->has_value() == true
|
inline |
Unchecked move of the stored value.
this->has_value() == true
|
inline |
Checked access of the stored value.
this->has_value() == true
error::Failure | if this->has_value() == false |
|
inline |
Checked move of the stored value.
this->has_value() == true
error::Failure | if this->has_value() == false |
|
inline |
Checked access of the stored value.
this->has_value() == true
error::Failure | if this->has_value() == false |
|
inline |
Checked move of the stored value.
this->has_value() == true
error::Failure | if this->has_value() == false |
|
inline |
Unchecked access of the stored error.
this->has_value() == false
|
inline |
Unchecked access of the stored error.
this->has_value() == false
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |