Opaque handles...
growler
growlercab at gmail.com
Thu Sep 19 02:53:27 PDT 2013
On Thursday, 19 September 2013 at 09:17:09 UTC, Kagamin wrote:
> On Wednesday, 18 September 2013 at 16:05:00 UTC, Manu wrote:
>> struct MyThing { void* handle; }
>>
>> I kinda hate this. the struct keyword totally gives the user
>> the wrong
>> impression, and people have a natural instinct to avoid
>> passing structs
>> around by value, which is exactly how these objects should be
>> handled...
>
> You've got some wrong people, lol. How do they work with smart
> pointers?
I had a similar problem not long ago and ended up using RefCount
from std.typecons. It worked well enough for my needs, maybe it
would be an option here.
I'm not sure of the performance though for a game situation,
you'd have to test it.
More information about the Digitalmars-d
mailing list