Partager via


auto_ptr::operator auto_ptr<Other>

Casts d'un type d' auto_ptr à un autre type d' auto_ptr.

template<class Other>
   operator auto_ptr<Other>( ) throw( );

Valeur de retour

L'opérateur de cast de type retourne auto_ptr <autre> (*this).

Exemple

// auto_ptr_op_auto_ptr.cpp
// compile with: /EHsc
#include <memory>
#include <iostream>
#include <vector>

using namespace std;
int main()
{
   auto_ptr<int> pi ( new int( 5 ) );
   auto_ptr<const int> pc = ( auto_ptr<const int> )pi;
}

Configuration requise

en-tête : <memory>

l'espace de noms : DST

Voir aussi

Référence

auto_ptr Class