G
gg
I am confused regarding what the line in the following function does.
It seems to work ok. It seems to be creating a new T object using the
pointer to an existing T object. But which function is it calling to
create the new T object?
void f ( auto_ptr < T > & aPT )
{
auto_ptr < T > newPT ( new T ( aPT.get ( ) ) );
}
If I do this,
void f ( auto_ptr < T > & aPT )
{
auto_ptr < T > newPT ( aPT.get ( ) );
}
Then I get core dump.
It seems to work ok. It seems to be creating a new T object using the
pointer to an existing T object. But which function is it calling to
create the new T object?
void f ( auto_ptr < T > & aPT )
{
auto_ptr < T > newPT ( new T ( aPT.get ( ) ) );
}
If I do this,
void f ( auto_ptr < T > & aPT )
{
auto_ptr < T > newPT ( aPT.get ( ) );
}
Then I get core dump.