std.parrallelism + scopedTask what is the right syntax
Dicebot
m.strashun at gmail.com
Thu Feb 21 02:59:25 PST 2013
On Thursday, 21 February 2013 at 08:05:08 UTC, bioinfornatics
wrote:
> ...
Looks like an issue with automatic inference of lambda type for
new lambda syntax. When I use old syntax "(size_t a) { return a <
stat.quartile1; }", it works better. Still won't compile, though,
as compiler won't convert function to delegate implicitly,
std.functional.toDelegate will help. Simple working example:
----
import std.parallelism, std.functional;
void func( bool delegate(size_t) lambda )
{
lambda(42);
}
void main()
{
auto task = scopedTask!func( toDelegate((size_t a) { return a
> 2; }) );
}
----
I'll file a bug for new lambda syntax type inference.
More information about the Digitalmars-d-learn
mailing list