Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2023-01-09 22:13:23


On 10/01/2023 07:15, Peter Dimov wrote:
> If I understand correctly, the lack of strong guarantee is caused by the by-value
> constructor moving from the argument even when construction fails? E.g.
>
> Foo foo( true, std::move( my_t ) );
> // leaves my_t moved-from on exception

If so, that doesn't seem like an unusual feature --
https://clang.llvm.org/extra/clang-tidy/checks/modernize/pass-by-value.html
strongly encourages that constructors accept movable values by value,
which will always move-from them even if the constructor later throws.
(If the parameter type's move/copy constructor throws then it gets more
complicated, though move constructors at least are typically expected to
not throw.)


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