
29 Aug
2008
29 Aug
'08
4:14 p.m.
On Fri, Aug 29, 2008 at 02:01, Phil Bouchard <philippe@fornux.com> wrote:
It's not a good design idea having that allocator passed in to the smart pointer's constructor. Here's why:
[snip]
This basically means that shared_ptr allocator implicit deletion idea only works with shared_ptr. It breaks consistency with everybody else.
It's not an allocator, and it's often useful in strange ways: shared_ptr<FILE> f( fopen("file.txt"), fclose ); The fact that the deleter is specified on initialization is also essential in that it allows you to create shared_ptrs to incomplete types: struct S { auto_ptr<S> p; }; // illegal struct S { shared_ptr<S> p; }; // fine So I don't really see your point, here. ~ Scott