GC-proof resource classes

skoppe via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 30 04:45:34 PDT 2015


On Sunday, 30 August 2015 at 09:54:31 UTC, ponce wrote:
> On Saturday, 29 August 2015 at 16:12:52 UTC, skoppe wrote:
>>
>> I don't think it is a good idea to call create_handle() in the 
>> constructor. Why not just pass a handle into the Resource?
>
> This isn't related to the topic.

By putting create_handle in the constructor, you inevitably end 
up putting free_handle in some (destructor) function. The 
problems you are having might be different/easier when you make 
something else do the (de)construction. Like, say, a 
ResourceManager.


More information about the Digitalmars-d mailing list