Boost logo

Boost :

Subject: Re: [boost] discussion of garbage collection in C++
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-04-25 20:45:31


On Sat, Apr 25, 2009 at 4:14 PM, Edward Diener <eldiener_at_[hidden]> wrote:
> Emil Dotchevski wrote:
>> On Sat, Apr 25, 2009 at 10:47 AM, Edward Diener <eldiener_at_[hidden]>
>> wrote:
>> One of the best features of shared_ptr is the fact that it abstracts
>> resource management at object instance level. I know this is wishful
>> thinking, but the ideal solution as far as I'm concerned would be to
>> implement GC as a custom (non-deterministic) allocation strategy,
>> per-instance, as a custom shared_ptr allocator.
>
> I don't think that it is easy to have user of an object decide for every
> object whether it is RAII or GC, which one would have to do with your
> ideally proposed shared_ptr<> custom allocator scheme

No, the user wouldn't have a choice; the user would call a factory funtion:

shared_ptr<foo> create_foo( ...... );

That's the beauty of the per-instance allocation strategy supported by
shared_ptr.

Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk