__gshared as part of alias

Johan Engelen j at j.nl
Wed Jan 17 22:01:57 UTC 2018


On Friday, 12 January 2018 at 04:25:25 UTC, Nicholas Wilson wrote:
> Is there a way to make __gshared part of an alias?

Hi Nick, how about this?

```
struct GSharedVariable(AddrSpace as, T)
{
     static __gshared T val;
     alias val this;
}
alias Global(T)   = GSharedVariable!(AddrSpace.Global,   T);

Global!float bar1; // __gshared
```

-Johan



More information about the Digitalmars-d-learn mailing list