|
Boost : |
Subject: Re: [boost] [C++11] If you have an old class with a throwing destructor...
From: Niall Douglas (s_sourceforge_at_[hidden])
Date: 2013-09-09 12:52:37
On 9 Sep 2013 at 18:41, Andrzej Krzemienski wrote:
> Your analysis is correct, but in practice the problem described by Daryle
> still exists. Authors of classes that throw in destructors need to take
> some action if they have written their libraries in C++03: either mark
> destructors as noexcept(false) or embed a sub-object (member or base class)
> that has a noexcept(false) destructor.
In C++03 it was always best practice to *always* wrap your
destructors in a try...catch clause. Now it's somewhat mandatory.
As an aside, we could really do with some new compiler warnings on
this actually. I already get caught enough times forgetting to mark
move constructors as noexcept, without which some STL implementations
will silently disable move construction completely.
Niall
-- Currently unemployed and looking for work. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk