Re: Is this should work?

2016-10-17 Thread Daniel Kozak via Digitalmars-d-learn
Dne 17.10.2016 v 11:56 markov via Digitalmars-d-learn napsal(a): Thanks. So something like this would be helpful in core.thread? void startThread(alias fun, P...)(P p){ new Thread({fun(p);}).start(); } or without delegate import std.stdio; import core.thread; void fun(alias a, alias

Re: Is this should work?

2016-10-17 Thread markov via Digitalmars-d-learn
Thanks. So something like this would be helpful in core.thread? void startThread(alias fun, P...)(P p){ new Thread({fun(p);}).start(); }

Re: Is this should work?

2016-10-16 Thread Ali Çehreli via Digitalmars-d-learn
On 10/16/2016 03:22 PM, markov wrote: void test(string line){ ... }; void main(){ string[] list; foreach (line; list) new Thread({test(line);}).start(); ... } It works in an unexpected way: In D, all those threads would close over the same 'line' loop variable, which happens to

Is this should work?

2016-10-16 Thread markov via Digitalmars-d-learn
void test(string line){ ... }; void main(){ string[] list; foreach (line; list) new Thread({test(line);}).start(); ... }

din.readf(%s, floattype) should work?

2010-01-29 Thread Michael P.
Is din.readf (from std.cstream in Phobos) able to read floats when using %s as the format specifier? When I used this: din.readf( %s, somedouble ); somedouble will still be nan after receiving input from the user. But when I use: din.readf( %f, somedouble ); everything goes as planned. Is this to

Re: din.readf(%s, floattype) should work?

2010-01-29 Thread Ali Çehreli
Michael P. wrote: Is din.readf (from std.cstream in Phobos) able to read floats when using %s as the format specifier? When I used this: din.readf( %s, somedouble ); somedouble will still be nan after receiving input from the user. But when I use: din.readf( %f, somedouble ); everything goes as