Boost logo

Boost :

From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-08-29 12:14:38


On Fri, Aug 29, 2008 at 02:01, Phil Bouchard <philippe_at_[hidden]> 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


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