Here's C ++ 17 current description of MoveAssignable:
t = rv;
If t and rv do not belong to the same object, t is equivalent to rv before the assignment state rv is undefined. [Note: rv must still satisfy the requirements of the library component, which using this, regardless of whether t and rv belong to the same object. The operations listed in these requirements should work, as indicated, rv has been moved with or not. - final note]
What does it mean that "rv still satisfies the requirements of the library component that uses it" are referenced?
What to do if t
they rv
relate to the same object? What can / should have a type with MoveAssignable in this case?
Does this description mean:
the library will not cause redirection with itself, so the type can do whatever it wants in this case (even crash)
or the type must somehow handle this case (the failure is not resolved), but its result does not matter
or something else?
Note: there are similar questions in SO, but there are conflicting / old (C ++ 14 has different rules) answers, comments, so I would like to clarify this.
source
share