shared_ptr& operator=( const shared_ptr& r ) noexcept;
(1)template< class Y >
shared_ptr& operator=( const shared_ptr<Y>& r ) noexcept;
shared_ptr& operator=( shared_ptr&& r ) noexcept;
(3)template< class Y >
shared_ptr& operator=( shared_ptr<Y>&& r ) noexcept;
Replaces the managed object with the one managed by r.
If *this already owns an object and it is the last shared_ptr
owning it, and r is not the same as *this, the object is destroyed through the owned deleter.
1,2) Shares ownership of the object managed by r. If r manages no object, *this manages no object too. Equivalent to shared_ptr<T>(r).swap(*this).
3,4) Move-assigns a shared_ptr
from r. After the assignment, *this contains a copy of the previous state of r, and r is empty. Equivalent to shared_ptr<T>(std::move(r)).swap(*this).
5) Transfers the ownership of the object managed by r to *this. If r manages no object, *this manages no object too. After the assignment, *this contains the pointer previously held by r, and use_count() == 1; also r is empty. Equivalent to shared_ptr<T>(r).swap(*this).
6) Transfers the ownership of the object managed by r to *this. The deleter associated to r is stored for future deletion of the managed object. r manages no object after the call. Equivalent to shared_ptr<T>(std::move(r)).swap(*this).
[edit] Parameters r - another smart pointer to share the ownership to or acquire the ownership from [edit] Return value*this
[edit] NotesThe implementation may meet the requirements without creating a temporary shared_ptr
object.
5,6) May throw implementation-defined exceptions.
[edit] Example [edit] See also replaces the managed objectRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4