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
Thanks.
So something like this would be helpful in core.thread?
void startThread(alias fun, P...)(P p){
new Thread({fun(p);}).start();
}
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
void test(string line){
...
};
void main(){
string[] list;
foreach (line; list)
new Thread({test(line);}).start();
...
}
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
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