Andrzej Krzemienski wrote:
This does not mean that all assignments are strong. In
variant
v1, v2; v1 = v2;
the assignment is basic, because that's the guarantee vector<string>::operator= gives.
Interesting. This satisfies the expectation that a number of people have expressed.
Exactly. For me basic is basic, regardless of whether the type stays the same, but apparently this does not match people's intuitive expectations.
But on the other hand, now that you are doing the double buffering anyway, making the assignment strong would come almost fo free.
Not free here because the above variant doesn't double-buffer (because all alternatives are nothrow move constructible).
If we continue the example with projections: if I change from the drop down menu from one mesh projection to another mesh projection, they are different projections, but can be encoded in the same type; maybe we should get the strong guarantee. If not in the assignment, then perhaps in a dedicated function.
You get the strong guarantee here in move assignment (because vector's move
assignment doesn't throw (... except for unequal allocators ...)):
v1 = std::move(v2); // strong
v1 = variant