diff options
author | Dan Vrátil <dvratil@redhat.com> | 2014-12-11 14:22:27 +0100 |
---|---|---|
committer | Dan Vrátil <dvratil@redhat.com> | 2014-12-11 14:22:27 +0100 |
commit | 1aee1bda9fc81c888ad18fea107c271133dd5442 (patch) | |
tree | ffb728821a78c0bdb1ff82543b7b3c18553da1c2 /async/src/async_impl.h | |
parent | 81b8158cca02defbfce5f1d59f06f7448fb5ea57 (diff) | |
download | sink-1aee1bda9fc81c888ad18fea107c271133dd5442.tar.gz sink-1aee1bda9fc81c888ad18fea107c271133dd5442.zip |
Async: change syntax of callables
We now pass our own Async::Future to each task, instead of expecting tasks
to return their future. This allows us to re-use the same Future for repeated
invocations, like in the Each task.
Diffstat (limited to 'async/src/async_impl.h')
-rw-r--r-- | async/src/async_impl.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/async/src/async_impl.h b/async/src/async_impl.h index 46bc25d..7b5c140 100644 --- a/async/src/async_impl.h +++ b/async/src/async_impl.h | |||
@@ -26,7 +26,26 @@ | |||
26 | 26 | ||
27 | namespace Async { | 27 | namespace Async { |
28 | 28 | ||
29 | namespace detail { | ||
30 | |||
31 | template<typename T> | ||
32 | struct identity | ||
33 | { | ||
34 | typedef T type; | ||
35 | }; | ||
36 | |||
37 | template<typename T, typename Enable = void> | ||
38 | struct isIterable { | ||
39 | enum { value = 0 }; | ||
40 | }; | ||
41 | |||
42 | template<typename T> | ||
43 | struct isIterable<T, typename std::conditional<false, typename T::iterator, void>::type> { | ||
44 | enum { value = 1 }; | ||
45 | }; | ||
46 | |||
47 | } // namespace Detail | ||
29 | 48 | ||
30 | } // namespace Async | 49 | } // namespace Async |
31 | 50 | ||
32 | #endif // ASYNC_IMPL_H \ No newline at end of file | 51 | #endif // ASYNC_IMPL_H |