std::weak_ptr::operator=
来自cppreference.com
|
|
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
| weak_ptr& operator=( const weak_ptr& r ); |
(1) | (C++11 起) |
| template< class Y > weak_ptr& operator=( const weak_ptr<Y>& r ); |
(2) | (C++11 起) |
| template< class Y > weak_ptr& operator=( const shared_ptr<Y>& r ); |
(3) | (C++11 起) |
替换与被管理对象的管理
r。 r的对象共享。如果r管理对象,*this管理也没有对象。相当于weak_ptr<T>(r).swap(*this).原文:
Replaces the managed object with the one managed by
r. The object is shared with r. If r manages no object, *this manages no object too. Equivalent to weak_ptr<T>(r).swap(*this).目录 |
[编辑] 参数
| r | - | 智能指针共享一个对象
原文: smart pointer to share an object with |
[编辑] 返回值
*this
[编辑] 例外
[编辑] 注释
实现可满足要求,而无需创建一个临时
weak_ptr对象.原文:
The implementation may meet the requirements without creating a temporary
weak_ptr object.