Add runTask overloads to make lambda argument inference work.

This commit is contained in:
Sönke Ludwig 2017-02-23 16:39:42 +01:00
parent 897c43051f
commit de718c4b1c
No known key found for this signature in database
GPG key ID: D95E8DB493EE314C

View file

@ -314,8 +314,18 @@ void setIdleHandler(bool delegate() @safe nothrow del)
Note that the maximum size of all args must not exceed `maxTaskParameterSize`. 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) 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); }); return runTask_internal!((ref tfi) { tfi.set(task, args); });
} }