
On Sat, Apr 25, 2009 at 4:14 PM, Edward Diener <eldiener@tropicsoft.com> wrote:
Emil Dotchevski wrote:
On Sat, Apr 25, 2009 at 10:47 AM, Edward Diener <eldiener@tropicsoft.com> 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