std::shared_ptr::operator=
Aus cppreference.com
< cpp | memory | shared ptr
![]() | This page has been machine-translated from the English version of the wiki using Google Translate. The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
shared_ptr& operator=(const shared_ptr& r ); | (1) | |
template<class Y > shared_ptr& operator=(const shared_ptr<Y>& r ); | (1) | |
shared_ptr& operator=( shared_ptr&& r ); | (2) | |
template<class Y > shared_ptr& operator=( shared_ptr<Y>&& r ); | (2) | |
template<class Y > shared_ptr& operator=(std::auto_ptr<Y>&& r ); | (3) | |
template<class Y, class Deleter > shared_ptr& operator=(std::unique_ptr<Y,Deleter>&& r ); | (4) | |
Ersetzt das verwaltete Objekt mit dem von
1) r
geschafft .Original:
Replaces the managed object with the one managed by
r
.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Aktien Besitz des Objekts verwaltet von
2) r
. Wenn r
kein Objekt verwaltet, verwaltet *this
kein Objekt zu. Die Vorlagen Überlastung nicht in der Überladungsauflösung teilnehmen, wenn Y*
weder implizit konvertierbar T*
. Entspricht shared_ptr<T> p(r).swap(*this) .Original:
Shares ownership of the object managed by
r
. If r
manages no object, *this
manages no object too. The templated overload doesn't participate in the overload resolution if Y*
is not implicitly convertible to T*
. Equivalent to shared_ptr<T> p(r).swap(*this).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Move-ordnet
3) shared_ptr
von r
. Nach der Abtretung *this eine Kopie des vorherigen Zustand r
enthält, r
ist leer. Die Vorlagen Überlastung nicht in der Überladungsauflösung teilnehmen, wenn Y*
weder implizit konvertierbar T*
. Entspricht shared_ptr<T> p(std::move(r)).swap(*this) .Original:
Move-assigns a
shared_ptr
from r
. After the assignment, *this contains a copy of the previous state of r
, r
is empty. The templated overload doesn't participate in the overload resolution if Y*
is not implicitly convertible to T*
. Equivalent to shared_ptr<T> p(std::move(r)).swap(*this).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
This section is incomplete |
Überträgt das Eigentum an dem Objekt durch
r
um *this verwaltet. Die deleter zugeordneten r
ist für zukünftige Deletion des verwalteten Objekts gespeichert. r
verwaltet kein Objekt nach dem Aufruf. Entspricht shared_ptr<T> p(std::move(r)).swap(*this) .Original:
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> p(std::move(r)).swap(*this).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Inhaltsverzeichnis |
[Bearbeiten]Parameter
r | - | ein weiteres Smart-Pointer, das Eigentum zu teilen oder erwirbt das Eigentum aus Original: another smart pointer to share the ownership to or acquire the ownership from The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[Bearbeiten]Rückgabewert
*this
[Bearbeiten]Notes
Die Implementierung kann die Anforderungen ohne eine temporäre
shared_ptr
Objekt treffen .Original:
The implementation may meet the requirements without creating a temporary
shared_ptr
object.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten]Ausnahmen
1-2) 3)(None)
4-5) Original:
(none)
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[Bearbeiten]Beispiel
This section is incomplete Reason: no example |
[Bearbeiten]Siehe auch
ersetzt das verwaltete Objekt Original: replaces the managed object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (öffentliche Elementfunktion) |