Bagikan melalui


auto_ptr::operator auto_ptr<Other>

Casts from one kind of auto_ptr to another kind of auto_ptr.

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

Return Value

The type cast operator returns auto_ptr <Other>(*this).

Example

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

Requirements

Header: <memory>

Namespace: std

See Also

Reference

auto_ptr Class