|
Boost : |
Subject: Re: [boost] [variant2] Comments on documentation
From: Andrzej Krzemienski (akrzemi1_at_[hidden])
Date: 2019-04-08 13:50:36
niedz., 7 kwi 2019 o 14:10 Peter Dimov via Boost <boost_at_[hidden]>
napisaÅ(a):
> Bjorn Reese wrote:
> > The destructor should be marked as noexcept.
>
> Destructors are noexcept by default.
>
Actually, that is not the case. The noexcept property of a destructor
without explicit noexcept annotation is determined by inspecting noexcept
property of destructors of non-static data members of the class and its
base classes. Since these subobjects are private implementation of your
class, and we are not aware of how their destructors are implemented, we
cannot determine whether variant's destructor is noexcept or not. Here's an
example:
```
class Detail
{
~Detail() noexcept(false);
};
class Variant
{
Detail _detail;
};
static_assert(std::is_nothrow_destructible_v<Variant> == false);
```
Regards,
&rzej;
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk