From de718c4b1c062e7f762cab5499c57c7d5c2ed584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Thu, 23 Feb 2017 16:39:42 +0100 Subject: [PATCH] Add runTask overloads to make lambda argument inference work. --- source/vibe/core/core.d | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source/vibe/core/core.d b/source/vibe/core/core.d index 62a0890..4f9c0d6 100644 --- a/source/vibe/core/core.d +++ b/source/vibe/core/core.d @@ -314,8 +314,18 @@ void setIdleHandler(bool delegate() @safe nothrow del) Note that the maximum size of all args must not exceed `maxTaskParameterSize`. */ +Task runTask(ARGS...)(void delegate(ARGS) @safe task, auto ref ARGS args) +{ + return runTask_internal!((ref tfi) { tfi.set(task, args); }); +} +/// +Task runTask(ARGS...)(void delegate(ARGS) @system task, auto ref ARGS args) +@system { + return runTask_internal!((ref tfi) { tfi.set(task, args); }); +} +/// ditto Task runTask(CALLABLE, ARGS...)(CALLABLE task, auto ref ARGS args) - if (is(typeof(CALLABLE.init(ARGS.init)))) + if (!is(CALLABLE : void delegate(ARGS)) && is(typeof(CALLABLE.init(ARGS.init)))) { return runTask_internal!((ref tfi) { tfi.set(task, args); }); }