Very limited shared promotion

Timon Gehr timon.gehr at gmx.ch
Tue Jun 18 14:14:06 UTC 2019


On 18.06.19 16:13, Timon Gehr wrote:
> 
> int sum(){ // note: just to illustrate the concept
>      int result=0;
>      foreach(i;iota(1000).parallel){
>          static assert(typeof(result)==shared(int));
>          result.atomic!"+="(i);
>      }
>      static assert(typeof(result)==int);
>      return result;
> }

Return type should have been int, of course...


More information about the Digitalmars-d mailing list