digitalmars.D.learn - std.parrallelism + scopedTask what is the right syntax
- bioinfornatics (13/13) Feb 21 2013 Hi,
- Dicebot (19/21) Feb 21 2013 Looks like an issue with automatic inference of lambda type for
- Dicebot (1/1) Feb 21 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9555
- bioinfornatics (3/4) Feb 21 2013 yes I confirm this bug.
Hi, I have a function like this: void writeRegionOutLimit( in string outFile, ref const size_t[] table, bool delegate(size_t) lambda, in string delimiter = ",") when I use it with scoped task compiling fail: auto job4 = scopedTask!writeRegionOutLimit( outFile ~ "min_warn.csv", table, (a => a < stat.quartile1 ), delimiter ); Error: template std.parallelism.scopedTask does not match any function template declaration Error: template std.parallelism.scopedTask cannot deduce template function from argument types !(writeRegionOutLimit)(string,ulong[],void,string) what is the problem ?
Feb 21 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 a2; }) );} ---- I'll file a bug for new lambda syntax type inference.
Feb 21 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9555
Feb 21 2013
On Thursday, 21 February 2013 at 11:07:13 UTC, Dicebot wrote:http://d.puremagic.com/issues/show_bug.cgi?id=9555yes I confirm this bug. I am happy^to see that is not my fault ^^
Feb 21 2013