23#ifndef PDCOM5_FUTURE_H
24#define PDCOM5_FUTURE_H
28#include <pdcom5_export.h>
32template <
class Exception,
class... Result>
48template <
class Exception,
class... Result>
52 using ResolveFn = std::function<void(Result...)>;
53 using RejectFn = std::function<void(
Exception)>;
58 impl_(std::move(impl))
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_;
129template <
class Exception,
class... Result>
130struct hash<PdCom::Future<Exception, Result...>> :
134template <
class Exception,
class... Result>
135struct less<PdCom::Future<Exception, Result...>> :
Callback management handle.
Definition Future.h:50
const Future & then(ResolveFn resolve) const &
Set continuation callback.
Future handle_exception(RejectFn reject) &&
Set error handling callback.
Future then(ResolveFn resolve) &&
Set continuation callback.
bool operator==(const Future &other) const noexcept
Equal comparsion.
Definition Future.h:118
bool empty() const noexcept
Definition Future.h:93
Future()=default
Default Constructor.
const Future & handle_exception(RejectFn reject) const &
Set error handling callback.
Definition Exception.h:34
Hash support, e.g. for std::unordered_set.
Definition Future.h:97
Less compare support, e.g. for std::set.
Definition Future.h:108