Parallel foreach iteration with Associative Arrays

Kirill kirill.saidov at mail.com
Sat Apr 17 01:57:34 UTC 2021


I'd like to iterate over an associative array and output it's key 
and value using parallel from std.parallelism.

But I get an error message: ParallelForeach!(int[string]) error 
instantiating.

My code:

auto example = ["apples": 100, "orange": 250, "banana": 175];
foreach(key, value; parallel(example)) { writeln(key, ": ", 
value); }

What am I doing wrong?

Thanks in advance.


More information about the Digitalmars-d-learn mailing list