struct or class

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 24 05:25:32 PDT 2014


On Sun, 24 Aug 2014 11:56:42 +0000
nikki via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

> Or should I use a class for that AtlasSpriteData?
> reading about it I get the impression everytime I'll look up data 
> from that dictionary data will get copied ?

this will copy:

  auto sd = dict[0];

this will copy:

  foreach (sd; dict) { ... }

this will not:

  const *sd = &dict[0];

this will not:
  foreach (ref sd; dict) { ... }


hope you got the idea.
-------------- 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/20140824/e6dc8528/attachment.sig>


More information about the Digitalmars-d-learn mailing list