2.7 KiB
| title |
|---|
| result |
{{< callout type="info">}}
Header: result.h
From: 20.17.0
Similar to: std::expected
{{< /callout >}}
{{< callout type="warning">}}
This class is deprecated.
Use etl::expected as a replacement.
{{< /callout >}}
A generic result type for returning either a result or an error. Deprecated. Use etl::expected
result
template <typename TValue, typename TError>
class result
template <typename TError>
class result<void, TError>
Description
Specialisation for void result.
result() = delete;
Description
Cannot be default constructed.
result(const result& other)
Description
Copy constructor.
result(result&& other)
Description
Move constructor.
result(const TValue& value)
Description
Construct from a value.
Not valid for void specialisation.
result(TValue&& value)
Description
Move construct from a value.
Not valid for void specialisation.
result(const TError& err)
Description
Construct from error.
result(TError&& err)
Description
Move construct from error.
result& operator =(const result& other)
Description
Copy assign.
result& operator =(result&& other)
Description
Move assign.
result& operator =(const TValue& value)
Description
Copy assign from value.
Not valid for void specialisation.
result& operator =(TValue&& value)
Description
Move assign from value.
Not valid for void specialisation.
result& operator =(const TError& err)
Description
Copy assign from error.
result& operator =(TError&& err)
Description
Move assign from error.
bool is_value() const
Description
true if result contains a value.
bool is_error() const
Description
true if result contains an error.
const TValue& value() const
Description
Returns a const reference to the value.
Undefined if the result does not contain an value.
Not valid for void specialisation.
TValue&& value()
Description
Returns an rvalue reference to the value.
Undefined if the result does not contain an value.
Not valid for void specialisation.
const TError& error() const
Description
Returns a const reference to the error.
Undefined if the result does not contain an error.
TError&& error()
Description
Returns an rvalue reference to the error.
Undefined if the result does not contain an error.