Using TreeSet and __gshared values

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Sep 3 13:10:38 PDT 2014


On Wed, 03 Sep 2014 19:53:15 +0000
nrgyzer via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com>
wrote:

__gshared class members are effectively "static", i.e. they are "class
members", not "instance members".

i.e.

class Entry {
  __gshared int value;
  ...
  static int getValue () { return value; }
}

works ok.

you have only one 'value' variable for all your instances.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20140903/66cb64a7/attachment.sig>


More information about the Digitalmars-d-learn mailing list