14struct PromiseResultCbType {
15 using Type = std::function<void(T&&)>;
19struct PromiseResultCbType<void> {
20 using Type = std::function<void()>;
26 virtual ~PromiseImpl() =
default;
27 virtual void on_result(
28 const typename detail::PromiseResultCbType<T>::Type& cb) = 0;
29 virtual void on_error(
const std::function<
void(
const Error&)>& cb) = 0;
49 Promise(std::unique_ptr<detail::PromiseImpl<T>> impl)
50 : _impl(std::move(impl)){};
51 Promise(
const Promise&) =
delete;
52 Promise(Promise&&) =
delete;
53 Promise& operator=(
const Promise&) =
delete;
54 Promise& operator=(Promise&&) =
delete;
63 Promise<T>& on_result(
64 const typename detail::PromiseResultCbType<T>::Type& cb) {
75 Promise<T>& on_error(
const std::function<
void(
const Error&)>& cb) {
88 void done() { _impl = {}; }
91 std::unique_ptr<detail::PromiseImpl<T>> _impl;
#define MILLICAST_TEMPLATE_API
Definition exports.h:46