File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ template <typename T>
6262GenericFuture<T>::GenericFuture()
6363{}
6464
65+ template <typename T>
66+ GenericFuture<T>::GenericFuture(const Promise<T>& p) :
67+ _context (local::context() ? p.getICoroFuture() : p.getIThreadFuture())
68+ {}
69+
6570template <typename T>
6671GenericFuture<T>::GenericFuture(ThreadContextPtr<T> f) :
6772 _context (f)
@@ -376,6 +381,20 @@ GenericFuture<T>::GenericFuture() :
376381 _threadContext()
377382{}
378383
384+ template <typename T>
385+ GenericFuture<T>::GenericFuture(const Promise<T>& p) :
386+ _type (local::context() ? Type::CoroFuture : Type::ThreadFuture)
387+ {
388+ if (_type == Type::ThreadFuture)
389+ {
390+ _threadFuture = p.getIThreadFuture ();
391+ }
392+ else
393+ {
394+ _coroFuture = p.getICoroFuture ();
395+ }
396+ }
397+
379398template <typename T>
380399GenericFuture<T>::GenericFuture(ThreadContextPtr<T> f) :
381400 _type (Type::ThreadContext),
Original file line number Diff line number Diff line change 1616#ifndef BLOOMBERGLP_QUANTUM_GENERIC_FUTURE_H
1717#define BLOOMBERGLP_QUANTUM_GENERIC_FUTURE_H
1818
19- #include < quantum/interface/quantum_ifuture.h>
20- #include < quantum/interface/quantum_icontext.h>
19+ #include < quantum/quantum_promise.h>
2120#if (__cplusplus >= 201703L)
2221#include < variant>
2322#endif
@@ -39,6 +38,7 @@ class GenericFuture : public IThreadFutureBase
3938public:
4039 // / @brief Constructors/Destructor
4140 GenericFuture ();
41+ GenericFuture (const Promise<T>& p);
4242 GenericFuture (ThreadContextPtr<T> f);
4343 GenericFuture (ThreadFuturePtr<T> f);
4444 GenericFuture (CoroContextPtr<T> f); // uses local context
You can’t perform that action at this time.
0 commit comments