Opaque handles...

Namespace rswhite4 at googlemail.com
Thu Sep 19 04:01:14 PDT 2013


On Thursday, 19 September 2013 at 09:53:28 UTC, growler wrote:
> 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.

Yes, that should be enough. But I, for my part, do not trust the 
phobos solution completely. Therefore I use my own.


More information about the Digitalmars-d mailing list