From 8e6f41f851ae058dea63fbc9b9f523ec9fd1a4fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Vr=C3=A1til?= Date: Fri, 20 Feb 2015 13:58:03 +0100 Subject: Async: allow appending existing Job objects to the Job chain Now it's possible to do something like Job job = createSomeJob(); auto main = Async::start(....).then(job); Previously the 'job' would have to be wrapped in a ThenTask-like lambda (which is what we still do internally), but with this new syntax it's possible to append another job chain to existing chain easilly. This syntax is available for all task types. --- async/src/async_impl.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'async/src/async_impl.h') diff --git a/async/src/async_impl.h b/async/src/async_impl.h index 58f6ced..eccbc9b 100644 --- a/async/src/async_impl.h +++ b/async/src/async_impl.h @@ -19,6 +19,7 @@ #define ASYNC_IMPL_H #include "async.h" +#include namespace Async { @@ -45,6 +46,20 @@ struct prevOut { using type = typename std::tuple_element<0, std::tuple>::type; }; +template +inline typename std::enable_if::value, void>::type +copyFutureValue(const Async::Future &in, Async::Future &out) +{ + out.setValue(in.value()); +} + +template +inline typename std::enable_if::value, void>::type +copyFutureValue(const Async::Future &in, Async::Future &out) +{ + // noop +} + } // namespace Detail } // namespace Async -- cgit v1.2.3