From 0a554aabb94cef6f7c4528534549c2a23514a44e Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 27 Apr 2015 11:19:10 +0200 Subject: Async: iterate to easily iterate over a container. --- async/src/async.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'async/src') diff --git a/async/src/async.h b/async/src/async.h index 62fb463..d6a74c0 100644 --- a/async/src/async.h +++ b/async/src/async.h @@ -276,6 +276,13 @@ Job dowhile(Condition condition, ThenTask func); */ Job dowhile(ThenTask body); +/** + * Iterate over a container. + * + * Use in conjunction with .each + */ +template +Job iterate(const Out &container); /** * A null job. @@ -577,6 +584,15 @@ Job error(int errorCode, const QString &errorMessage) }); } +template +Job iterate(const Out &container) +{ + return Async::start( + [container]() { + return container; + }); +} + namespace Private { -- cgit v1.2.3