Here's C++17's current description of MoveAssignable:
t = rv;
If t and rv do not refer to the same object, t is equivalent to the value of rv before the assignment rv's state is unspecified. [ Note: rv must still meet the requirements of the library component that is using it, whether or not t and rv refer to the same object. The operations listed in those requirements must work as specified whether rv has been moved from or not. — end note ]
What does "rv must still meet the requirements of the library component that is using it" refer to?
What if t
& rv
refer to the same object? What can/should a type with MoveAssignable do in this case?
Does the description mean:
the library won't call move assignment with self at all, so the type can do whatever it wants in this case (even crash)
or the type should handle this case somehow (no crashing allowed), but its result doesn't matter
or something else?
Note: there are similar questions here at SO, but there are conflicting/old (C++14 has different rules) answers, comments, so I'd like to clarify this.