parallelism
Arun Chandrasekaran
aruncxy at gmail.com
Sat Jan 27 10:28:10 UTC 2018
Hi All,
Is there a way to rewrite this
```
import std.parallelism;
auto pool = new TaskPool(options.threadCount);
foreach (_; 0 .. options.iterationCount) {
switch (options.operation) {
case Operation.a:
pool.put(task!a(options));
break;
case Operation.b:
pool.put(task!b(options));
break;
case Operation.c:
pool.put(task!c(options));
break;
case Operation.d:
pool.put(task!d(options));
break;
/// and so on.
}
pool.finish();
```
into this?
```
import std.parallelism;
import std.conv: to;
auto pool = new TaskPool(options.threadCount);
foreach (_; 0 .. options.iterationCount) {
pool.put(task!(to!string(options.operation))(options));
// this line errs.
}
pool.finish();
```
--
Arun
More information about the Digitalmars-d-learn
mailing list