Condividi tramite


auto_ptr::operator=

Un operatore di assegnazione che trasferisce la proprietà di un oggetto auto_ptr a un altro.

template<class Other>
   auto_ptr<Type>& operator=(
      auto_ptr<Other>& _Right
   ) throw( );
auto_ptr<Type>& operator=(
   auto_ptr<Type>& _Right
) throw( );
auto_ptr<Type>& operator=(
   auto_ptr_ref<Type> _Right
) throw( );

Parametri

  • _Right
    Oggetto di tipo auto_ptr.

Valore restituito

Un riferimento a un oggetto di tipo auto_ptr<Tipo>.

Note

L'assegnazione valuta l'espressione delete myptr, ma solo se le modifiche archiviate myptr del puntatore in seguito all'assegnazione.Quindi la proprietà del puntatore archiviato nel _Right, archiviando il _Right.versione in myptr.La funzione restituisce *this.

Esempio

Per un esempio di utilizzo dell'operatore membro, vedere auto_ptr::auto_ptr.

Requisiti

intestazione: <memory>

Spazio dei nomi: deviazione standard

Vedere anche

Riferimenti

auto_ptr Class