GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::shared_ptr::operator=(3) C++ Standard Libary std::shared_ptr::operator=(3)

std::shared_ptr::operator= - std::shared_ptr::operator=


shared_ptr& operator=( const shared_ptr& r ) noexcept; (1)
template< class Y > (1)
shared_ptr& operator=( const shared_ptr<Y>& r ) noexcept;
shared_ptr& operator=( shared_ptr&& r ) noexcept; (2)
template< class Y > (2)
shared_ptr& operator=( shared_ptr<Y>&& r ) noexcept;
template< class Y > (3) (deprecated in C++11)
shared_ptr& operator=( std::auto_ptr<Y>&& r ); (removed in C++17)
template< class Y, class Deleter > (4)
shared_ptr& operator=( std::unique_ptr<Y,Deleter>&& r );


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) 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).
2) 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).
3) 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).
4) 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).


r - another smart pointer to share the ownership to or acquire the ownership from


*this


The implementation may meet the requirements without creating a temporary shared_ptr
object.


3-4) May throw implementation-defined exceptions.


This section is incomplete
Reason: no example


reset replaces the managed object
(public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.