23 #ifndef PDCOM5_FUTURE_H 24 #define PDCOM5_FUTURE_H 26 #include "pdcom5_export.h" 33 template <
class Exception,
class... Result>
49 template <
class Exception,
class... Result>
53 using ResolveFn = std::function<void(Result...)>;
54 using RejectFn = std::function<void(Exception)>;
59 impl_(std::move(impl))
71 const Future &then(ResolveFn resolve)
const &;
77 Future then(ResolveFn resolve) &&;
83 const Future &handle_exception(RejectFn reject)
const &;
89 Future handle_exception(RejectFn reject) &&;
94 bool empty() const noexcept {
return !impl_.operator bool(); }
99 std::size_t operator()(
Future const &future)
const 110 bool operator()(
const Future &lhs,
const Future &rhs)
const noexcept
112 return std::owner_less<
114 lhs.impl_, rhs.impl_);
121 return other.impl_ == impl_;
130 template <
class Exception,
class... Result>
131 struct hash<
PdCom::Future<Exception, Result...>> :
135 template <
class Exception,
class... Result>
136 struct less<
PdCom::Future<Exception, Result...>> :
143 #endif // PDCOM5_FUTURE_H Definition: Exception.h:34
bool empty() const noexcept
Definition: Future.h:94
Callback management handle.
Definition: Future.h:50
Hash support, e.g. for std::unordered_set.
Definition: Future.h:97
Less compare support, e.g. for std::set.
Definition: Future.h:108
bool operator==(const Future &other) const noexcept
Equal comparsion.
Definition: Future.h:119
library version string as "major.minor.patch"
Definition: ClientStatistics.h:31