Trying to sort shared data with a predicate causes 'unable to format shared objects'

George Sapkin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jun 17 08:51:47 PDT 2014


Does making an array copy with shared cast away make any sense?

auto n = 10;
auto sharedData = new shared SomeClass[n];
foreach (i; 0..n) sharedData[i] = new shared SomeClass(i);

auto nonSharedData = cast(SomeClass[]) sharedData[0..$];
auto sorted = sort!((a, b) => a.value < b.value)(nonSharedData);

This seems to work but what are the implications?


More information about the Digitalmars-d-learn mailing list