◐ Shell
clean mode source ↗

std::shared_ptr::operator= - cppreference.com

Da cppreference.com.

Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.

La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui.

Click here for the English version of this page

<metanoindex/>

<tbody> </tbody>

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)

Sostituisce l'oggetto gestito con quello gestito da r.

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.

1)

Azioni proprietà dell'oggetto gestito da r. Se r gestisce nessun oggetto, *this gestisce nessun oggetto troppo. Il sovraccarico basato su modelli non prende parte alla risoluzione di sovraccarico se Y* non è convertibile in modo implicito T*. Equivalente a 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.

2)

Move-assegna un shared_ptr da r. Dopo l'assegnazione, *this contiene una copia del precedente stato di r, r è vuoto. Il sovraccarico basato su modelli non prende parte alla risoluzione di sovraccarico se Y* non è convertibile in modo implicito T*. Equivalente a 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.

3)

4)

Trasferisce la proprietà dell'oggetto gestito da r a *this. Il deleter associata r viene memorizzato per l'eliminazione futuro l'oggetto gestito. r gestisce nessun oggetto dopo la chiamata. Equivalente a 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.

Parametri

r -

un altro puntatore intelligente per condividere la proprietà o acquisire la proprietà di

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.

Valore di ritorno

*this

Note

L'implementazione può soddisfare le esigenze senza creare un oggetto temporaneo shared_ptr.

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.

Eccezioni

1-2)

3)

(Nessuno)

Original:

(none)

The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

4-5)

Esempio

Vedi anche

sostituisce l'oggetto gestito

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.


(metodo pubblico) [modifica]