3 #include <fsdk/Types/Result.h>
20 template <
typename R,
typename V,
class Enable =
void>
23 template <
typename R,
typename V>
24 struct ResultValue<R, V, typename std::enable_if<std::is_copy_constructible<V>::value>::type> :
Result<R> {
54 , m_value(std::move(value)) {
62 assert(this->
isOk() &&
"Acessing value of erroneous result.");
73 return std::move(m_value);
97 template <
typename R,
typename V>
98 struct ResultValue<R, V, typename std::enable_if<std::is_copy_constructible<V>::value == false>::type> :
120 , m_value(std::move(value)) {
128 assert(this->
isOk() &&
"Acessing value of erroneous result.");
139 return std::move(m_value);
164 template <
typename R,
typename V>
169 std::forward<V>(value));
V ValueType
Result value type.
Definition: ResultValue.h:104
V && takeValue() noexcept
Gets result value as rvalue.
Definition: ResultValue.h:138
ResultValue(R result, V &&value) noexcept
Initializes result.
Definition: ResultValue.h:52
A structure that encapsulates an action result enumeration.
Definition: Result.h:27
R EnumType
Result enumeration type.
Definition: ResultValue.h:101
R EnumType
Result enumeration type.
Definition: ResultValue.h:26
ResultValue(R result, const V &value) noexcept
Initializes result.
Definition: ResultValue.h:43
const V & getValue() const noexcept
Gets result value.
Definition: ResultValue.h:61
V m_value
Actual value.
Definition: ResultValue.h:151
V && takeValue() noexcept
Gets result value as rvalue.
Definition: ResultValue.h:72
const V & getValue() const noexcept
Gets result value.
Definition: ResultValue.h:127
ResultValue< R, typename std::remove_const< typename std::remove_reference< V >::type >::type > makeResultValue(R result, V &&value) noexcept
Addon for Result to output some value aside the result.
Definition: ResultValue.h:166
Addon for Result to output some value aside the result. Specialization for copiable types...
Definition: ResultValue.h:21
const V * operator->() const noexcept
Gets result value.
Definition: ResultValue.h:146
ResultValue(R result, V &&value) noexcept
Initializes result.
Definition: ResultValue.h:118
ResultValue(R result) noexcept
Initializes result.
Definition: ResultValue.h:34
V ValueType
Result value type.
Definition: ResultValue.h:29
ResultValue(R result) noexcept
Initializes result.
Definition: ResultValue.h:109
const V * operator->() const noexcept
Gets result value.
Definition: ResultValue.h:80
V m_value
Actual value.
Definition: ResultValue.h:85
bool isOk() const noexcept
Checks for a success.
Definition: Result.h:62