CPB Mailing List

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: STL Simple Question



The simple answer is that this is not what auto_ptr is for.  You should
pass the ptr you want to wrap into the c'tor.

std::auto_ptr<char> VarC(new char);

The assignment operators for auto_ptr are for assignment of one auto_ptr
to another.

auto_ptr<char> A(new char), B(new char);
A = B;

The ptr that is wrapped in A will be deleted and it will take ownership
of B's ptr.


W Komornicki's Home Page | Main Index | Thread Index