从一个转换为另一个 auto_ptrauto_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