static __gshared struct
Hiemlick Hiemlicker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 2 11:17:41 PDT 2016
On Saturday, 2 July 2016 at 03:54:26 UTC, Mike Parker wrote:
> On Saturday, 2 July 2016 at 00:08:10 UTC, Hiemlick Hiemlicker
> wrote:
>
>>
>> I use a struct with static members so I do not have to
>> instantiate it. It is essentially a singleton. I want all the
>> variables to be __gshared. I guess I have to prefix all
>> variables with it?
>>
>> Basically I have Foo.i; on foo. i is static, of course. I also
>> want it to be __gshared.
>>
>> Makes sense to me that
>>
>> __gshared struct x;
>>
>> all of x's variables should be __gshared.
>
> struct Foo {
> __gshared:
> static int x;
> static float y;
> }
>
> Or:
>
> struct Foo {
> __gshared {
> static int x;
> static float y;
> }
> }
Thanks, that will work.
More information about the Digitalmars-d-learn
mailing list