8#include <aws/core/Core_EXPORTS.h>
24 template<
typename R,
typename E>
29 Outcome() : result(), error(), success(false)
32 Outcome(
const R& r) : result(r), error(), success(true)
35 Outcome(
const E& e) : result(), error(e), success(false)
38 Outcome(R&& r) : result(std::forward<R>(r)), error(), success(true)
41 Outcome(E&& e) : result(), error(std::forward<E>(e)), success(false)
51 template<
typename RT,
typename ET>
54#if defined (__cplusplus) && __cplusplus > 201103L
55 template<
bool B,
class T =
void >
58 template<
bool B,
class T =
void >
63 template<typename RT, typename ET, enable_if_t<std::is_convertible<RT, R>::value &&
64 std::is_convertible<ET, E>::value,
int> = 0>
66 result(std::move(o.result)),
67 error(std::move(o.error)),
73 template<typename RT, typename ET, enable_if_t<std::is_convertible<RT, R>::value &&
74 !std::is_convertible<ET, E>::value,
int> = 0>
76 result(std::move(o.result)),
83 template<typename RT, typename ET, enable_if_t<!std::is_convertible<RT, R>::value &&
84 std::is_convertible<ET, E>::value,
int> = 0>
86 error(std::move(o.error)),
92 template<typename ET, enable_if_t<std::is_convertible<ET, E>::value,
int> = 0>
93 Outcome(ET&& e) : error(std::forward<ET>(e)), success(false)
104 retryCount = o.retryCount;
111 result(std::move(o.result)),
112 error(std::move(o.error)),
114 retryCount(std::move(o.retryCount))
122 result = std::move(o.result);
123 error = std::move(o.error);
125 retryCount = std::move(o.retryCount);
147 return std::move(result);
158 return error.template GetModeledError<T>();
163 return this->success;
173 inline void SetRetryCount(
const unsigned int iRetryCount) { retryCount = iRetryCount; }
178 bool success =
false;
179 unsigned int retryCount = 0;
Outcome & operator=(Outcome &&o)
Outcome(Outcome< RT, ET > &&o)
const E & GetError() const
const R & GetResult() const
R && GetResultWithOwnership()
Outcome(const Outcome &o)
typename std::enable_if< B, T >::type enable_if_t
Outcome & operator=(const Outcome &o)
void SetRetryCount(const unsigned int iRetryCount)
unsigned int GetRetryCount() const