@
blinue 如果是 vector,other 是会为空的,cppreference 上有提到这点;
https://stackoverflow.com/a/17735913/6947776 这里有更详细的解释:
This operation must have constant complexity ...So for the move constructor, yes, the moved-from vector will always be empty. This is not directly specified, but falls out of the complexity requirement, and the fact that there is no other way to implement it.
而 map 的相关信息不多,cppreference 也没提到 other 是否为空的事情,但有复杂度的条款:
Constant. If alloc is given and alloc != other.get_allocator(), then linear.
所以我很好奇这里会不会也和 vector 有类似的情况。