23 #ifndef PDCOM5_FUTURE_H 24 #define PDCOM5_FUTURE_H 28 #include <pdcom5_export.h> 32 template <
class Exception,
class... Result>
48 template <
class Exception,
class... Result>
52 using ResolveFn = std::function<void(Result...)>;
53 using RejectFn = std::function<void(Exception)>;
58 impl_(std::move(impl))
70 const Future &then(ResolveFn resolve)
const &;
76 Future then(ResolveFn resolve) &&;
82 const Future &handle_exception(RejectFn reject)
const &;
88 Future handle_exception(RejectFn reject) &&;
93 bool empty() const noexcept {
return !impl_.operator bool(); }
98 std::size_t operator()(
Future const &future)
const 109 bool operator()(
const Future &lhs,
const Future &rhs)
const noexcept
111 return std::owner_less<
113 lhs.impl_, rhs.impl_);
120 return other.impl_ == impl_;
129 template <
class Exception,
class... Result>
130 struct hash<
PdCom::Future<Exception, Result...>> :
134 template <
class Exception,
class... Result>
135 struct less<
PdCom::Future<Exception, Result...>> :
142 #endif // PDCOM5_FUTURE_H Definition: Exception.h:33
bool empty() const noexcept
Definition: Future.h:93
Callback management handle.
Definition: Future.h:49
Hash support, e.g. for std::unordered_set.
Definition: Future.h:96
Less compare support, e.g. for std::set.
Definition: Future.h:107
bool operator==(const Future &other) const noexcept
Equal comparsion.
Definition: Future.h:118
Definition: ClientStatistics.h:31