Boost logo

Boost :

Subject: Re: [boost] [variant2] Comments on documentation
From: Peter Dimov (pdimov_at_[hidden])
Date: 2019-04-08 14:23:32


Andrzej Krzemienski wrote:
> 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.

This is an interesting point. However, the standard doesn't mark the
destructors as noexcept, and I'm not sure I see why this same logic doesn't
apply to it.

http://eel.is/c++draft/variant.dtor
http://eel.is/c++draft/optional.dtor
http://eel.is/c++draft/any.cons#23
http://eel.is/c++draft/unique.ptr.single.dtor


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