On 10/01/24 7:23 AM, Bonita Montero wrote:
Am 01.10.2024 um 16:21 schrieb Andrey Tarasevich:
Um... Why would this even be a question? Why would the idea of
"calling the destructor manually" even enter consideration?
Because I've never used delegating constructors so far and I didn't
know where the object entered the state with complete construction.
[except.ctor] says
4 If the compound-statement of the function-body of a delegating
constructor for an object exits via an exception, the object's
destructor is invoked. [...]
https://timsong-cpp.github.io/cppwp/except.ctor#4
I.e. once the the target constructor has finished its work, the object
is considered to be fully constructed, and it is considered to be OK to
invoke its "full" destructor. So, if the delegating constructor body
throws, the entire object's destructor is invoked (automatically).
This is different from situation when regular constructor throws. In
that case individual sub-object destructors are invoked one by one.
But in either case, the destructor(s) is(are) invoked automatically. No
need to do it manually.
--
Best regards,
Andrey
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)