|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-04-11 00:25:48
on 4/10/00 9:06 PM, Mark Borgerding at mborgerding_at_[hidden] wrote:
> I guess I was remembering the CD2 behavior. I just looked again and realized
> that
> the definition had changed in the final standard.
>
> So if ~auto_ptr has an empty excep. spec. , why does boost::shared_ptr allow
> exceptions out?
> Shouldn't we change this to make it as consistent as possible with the
> auto_ptr
> interface?
Both auto_ptr (I know) and boost::shared_ptr (I hope) prohibit the
destructor of the type parameter from throwing, so you can portably remove
the exception-specification on the implementation of either smart pointer's
destructor. We do this for efficiency reasons and because of the reasons I
quoted earlier that make a throwing destructor nonsensical.
> What I meant was that allowing excpetions out of the d'tor makes a smart
> pointer to
> a Foo act like an automatic Foo object.
> i.e. If Foo::~Foo can throw an exception , so can
> smartptr<Foo>::~smartptr<Foo>
OK, though I don't really think that carries much weight, since it doesn't
make any sense to have a throw from a destructor under current language
rules.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk