|
peelo-result
|
#include <result.hpp>
Public Types | |
| using | value_type = T |
| using | error_type = E |
Public Member Functions | |
| result (const value_type &value) | |
| result (value_type &&value) | |
| result (const result &that) | |
| result (result &&that) | |
| template<class U, class G> | |
| result (const result< U, G > &that) | |
| ~result () | |
| result & | operator= (const result &that) |
| template<class U, class G> | |
| result & | operator= (const result< U, G > &that) |
| result & | operator= (result &&that) |
| constexpr bool | has_value () const noexcept |
| constexpr | operator bool () const noexcept |
| constexpr bool | operator! () const noexcept |
| constexpr value_type & | value () noexcept |
| const value_type & | value () const noexcept |
| constexpr value_type * | operator-> () noexcept |
| constexpr const value_type * | operator-> () const noexcept |
| constexpr value_type & | operator* () noexcept |
| constexpr const value_type & | operator* () const noexcept |
| constexpr error_type & | error () noexcept |
| constexpr const error_type & | error () const noexcept |
| template<class U> | |
| value_type | value_or (U &&default_value) const |
| template<class U> | |
| error_type | error_or (U &&default_error) const |
| bool | equals (const result &that) const |
| bool | operator== (const result &that) const |
| bool | operator!= (const result &that) const |
| template<class U, class G> | |
| bool | equals (const result< U, G > &that) const |
| template<class U, class G> | |
| bool | operator== (const result< U, G > &that) const |
| template<class U, class G> | |
| bool | operator!= (const result< U, G > &that) const |
Static Public Member Functions | |
| template<class... Args> | |
| static result< T, E > | ok (Args &&... args) |
| static result< T, E > | error (const error_type &error) |
| template<class... Args> | |
| static result< T, E > | error (Args &&... args) |
Represents result of an operation that might be successful or erroneous.
The result contains either an value or error.
| using peelo::result< T, E >::error_type = E |
| using peelo::result< T, E >::value_type = T |
|
inline |
Constructs an successful result with given value.
|
inline |
Constructs an successful result with given value.
|
inline |
Copy constructor.
|
inline |
Move constructor.
|
inline |
Copy constructor.
|
inline |
Destructor.
|
inline |
Tests whether two results are equal or not.
|
inline |
Tests whether two results are equal or not.
|
inlineconstexprnoexcept |
Accesses error contained in the result. If the result contains value instead of error, expect undefined behavior.
|
inlineconstexprnoexcept |
Accesses error contained in the result. If the result contains value instead of error, expect undefined behavior.
|
inlinestatic |
Constructs an erroneous result from given arguments.
|
inlinestatic |
Constructs an erroneous result with given error.
|
inline |
Returns error contained in the result, or given default error if the result contains value instead of error.
|
inlineconstexprnoexcept |
Returns true if this result has an value and false if it has an error.
|
inlinestatic |
Constructs an successful result from given arguments.
|
inlineexplicitconstexprnoexcept |
Returns true if this result has an value and false if it has an error.
|
inlineconstexprnoexcept |
Returns false if this result has an value and true if it has an error.
|
inline |
Non-equality testing operator.
|
inline |
Non-equality testing operator.
|
inlineconstexprnoexcept |
References value contained in the result. If the result contains error instead of value, expect undefined behavior.
|
inlineconstexprnoexcept |
References value contained in the result. If the result contains error instead of value, expect undefined behavior.
|
inlineconstexprnoexcept |
Accesses value contained in the result. If the result contains error instead of value, expect undefined behavior.
|
inlineconstexprnoexcept |
Accesses value contained in the result. If the result contains error instead of value, expect undefined behavior.
|
inline |
Assignment operator.
|
inline |
Assignment operator.
|
inline |
Move operator.
|
inline |
Equality testing operator.
|
inline |
Equality testing operator.
|
inlinenoexcept |
Accesses value contained in the result. If the result contains error instead of value, expect undefined behavior.
|
inlineconstexprnoexcept |
Accesses value contained in the result. If the result contains error instead of value, expect undefined behavior.
|
inline |
Returns value contained in the result, or given default value if the result contains error instead of value.