看 shared_ptr 里 operator=的解释,
第二条,
move (2)
shared_ptr& operator= (shared_ptr&& x) noexcept;
解释:
The move assignments (2) transfer ownership from x to the shared_ptr object without altering the use_count. x becomes an empty shared_ptr (as if default-constructed).
我不明白的有两点:
-
双引用号是什么?
-
move(2) 表达的是什么情况?我能想象到的情景就是 share_ptr<int> ptr_i = shared_ptr<int>(new int) 这种情况,后面的是 x,这句过后就没了。