specialization of the expected class which can contain an error as well as a success value
More...
|
| expected ()=delete |
| default ctor is deleted since you have to clearly state if the expected contains a success value or an error value
|
|
| expected (const expected &) noexcept=default |
| the copy constructor calls the copy constructor of the contained success value or the error value - depending on what is stored in the expected
|
|
| expected (expected &&rhs) noexcept |
| the move constructor calls the move constructor of the contained success value or the error value - depending on what is stored in the expected
|
|
| ~expected () noexcept=default |
| calls the destructor of the success value or error value - depending on what is stored in the expected
|
|
expected & | operator= (const expected &) noexcept |
| calls the copy assignment operator of the contained success value or the error value - depending on what is stored in the expected
|
|
expected & | operator= (expected &&rhs) noexcept |
| calls the move assignment operator of the contained success value or the error value - depending on what is stored in the expected
|
|
| expected (const success< ValueType > &successValue) noexcept |
| constructs an expected which is signaling success and uses the value provided by successValue to copy construct its success value
|
|
| expected (success< ValueType > &&successValue) noexcept |
| constructs an expected which is signaling success and uses the value provided by successValue to move construct its success value
|
|
| expected (const error< ErrorType > &errorValue) noexcept |
| constructs an expected which is signaling an error and stores the error value provided by errorValue
|
|
| expected (error< ErrorType > &&errorValue) noexcept |
| constructs an expected which is signaling an error and stores the error value provided by errorValue
|
|
| operator bool () const noexcept |
| returns true if the expected contains an error otherwise false
|
|
bool | has_error () const noexcept |
| returns true if the expected contains an error otherwise false
|
|
ErrorType & | get_error () &noexcept |
| returns a reference to the contained error value, if the expected does not contain an error this is undefined behavior
|
|
const ErrorType & | get_error () const &noexcept |
| returns a const reference to the contained error value, if the expected does not contain an error this is undefined behavior
|
|
ErrorType && | get_error () &&noexcept |
| returns a rvalue reference to the contained error value, if the expected does not contain an error this is undefined behavior
|
|
ValueType & | value () &noexcept |
| returns a reference to the contained success value, if the expected does not contain a success value this is undefined behavior
|
|
const ValueType & | value () const &noexcept |
| returns a const reference to the contained success value, if the expected does not contain a success value this is undefined behavior
|
|
ValueType && | value () &&noexcept |
| returns a reference to the contained success value, if the expected does not contain a success value this is undefined behavior
|
|
ValueType | value_or (const ValueType &value) const noexcept |
| returns a copy of the contained success value if the expected does contain a success value, otherwise it returns a copy of value
|
|
ValueType | value_or (const ValueType &value) noexcept |
| returns a copy of the contained success value if the expected does contain a success value, otherwise it returns a copy of value
|
|
ValueType & | operator* () noexcept |
| dereferencing operator which returns a reference to the contained success value. if the expected contains an error the behavior is undefined.
|
|
const ValueType & | operator* () const noexcept |
| dereferencing operator which returns a reference to the contained success value. if the expected contains an error the behavior is undefined.
|
|
ValueType * | operator-> () noexcept |
| arrow operator which returns the pointer to the contained success value. if the expected contains an error the behavior is undefined.
|
|
const ValueType * | operator-> () const noexcept |
| arrow operator which returns the pointer to the contained success value. if the expected contains an error the behavior is undefined.
|
|
template<typename T > |
| operator expected< T > () noexcept |
| conversion operator to an error only expected which can be useful if you would like to return only the success of a function
|
|
template<typename T > |
| operator expected< T > () const noexcept |
| conversion operator to an error only expected which can be useful if you would like to return only the success of a function
|
|
const expected & | or_else (const cxx::function_ref< void(ErrorType &)> &callable) const noexcept |
| if the expected does contain an error the given callable is called and a reference to the ErrorType is given as an argument to the callable
|
|
expected & | or_else (const cxx::function_ref< void(ErrorType &)> &callable) noexcept |
| if the expected does contain an error the given callable is called and a reference to the ErrorType is given as an argument to the callable
|
|
const expected & | and_then (const cxx::function_ref< void(ValueType &)> &callable) const noexcept |
| if the expected does contain a success value the given callable is called and a reference to the result is given as an argument to the callable
|
|
expected & | and_then (const cxx::function_ref< void(ValueType &)> &callable) noexcept |
| if the expected does contain a success value the given callable is called and a reference to the result is given as an argument to the callable
|
|
template<typename Optional = ValueType, typename std::enable_if< internal::IsOptional< Optional >::value, int >::type = 0> |
const expected & | and_then (const cxx::function_ref< void(typename Optional::type &)> &callable) const noexcept |
| if the expected contains a success value and its type is a non-empty optional, retrieve the value from the optional and provide it as the argument to the provided callable
|
|
template<typename Optional = ValueType, typename std::enable_if< internal::IsOptional< Optional >::value, int >::type = 0> |
expected & | and_then (const cxx::function_ref< void(typename Optional::type &)> &callable) noexcept |
| if the expected contains a success value and its type is a non-empty optional, retrieve the value from the optional and provide it as the argument to the provided callable
|
|
template<typename Optional = ValueType, typename std::enable_if< internal::IsOptional< Optional >::value, int >::type = 0> |
const expected & | if_empty (const cxx::function_ref< void()> &callable) const noexcept |
| if the expected contains a success value and its type is an empty optional, calls the provided callable
|
|
template<typename Optional = ValueType, typename std::enable_if< internal::IsOptional< Optional >::value, int >::type = 0> |
expected & | if_empty (const cxx::function_ref< void()> &callable) noexcept |
| if the expected contains a success value and its type is an empty optional, calls the provided callable
|
|
optional< ValueType > | to_optional () const noexcept |
|
template<typename ValueType, typename ErrorType>
class iox::cxx::expected< ValueType, ErrorType >
specialization of the expected class which can contain an error as well as a success value
- Parameters
-
ValueType | type of the value which can be stored in the expected |
ErrorType | type of the error which can be stored in the expected |