2017-06-08 14:59 GMT+02:00 Peter Dimov via Boost
Andrzej Krzemienski wrote:
2017-06-06 14:20 GMT+02:00 Peter Dimov via Boost
: Types don't generally provide the strong guarantee on assignment as it doesn't compose. If type T has strong assign, type U has strong assign, > struct { T t; U u; } no longer does. So it's more efficient to just do > basic everywhere, which does compose, and then at the specific point you > want the strong guarantee, use f.ex. the copy and swap trick to get it.
I think the reasoning behind Niall's position is that a type `X` can have a custom guarantee: upon its assignment it guarantees that after a throw the type is either unchanged or goes to fallback state `0`. This guarantee is
stronger than basic, and weaker than strong.
Types _could_ provide such a guarantee, but don't, for the same reason they don't provide strong - as outlined in the quoted paragraph above, if types X and Y provide it, struct { X x; Y y; } no longer does. So it's additional work, and buys nothing much.
Yes, such guarantee is not composable when you put X into product types.
But it still could work for certain cases of assignments of variant