Поделиться через


auto_ptr::operator auto_ptr<Other>

Преобразования из одного типа auto_ptr в другой тип auto_ptr.

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

Возвращаемое значение

Оператор приведения типов возвращает auto_ptr <Другой>(*this).

Пример

// 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;
}

Требования

Заголовок:<memory>

Пространство имен: std

См. также

Ссылки

Класс auto_ptr