A
A
I know that I can delete this:
TStruct *a = new TStruct();
delete a;
but is it possible to delete this too:
std::auto_ptr<TStruct> a(new TStruct());
or this
boost::scoped_ptr<TStruct> a(new TStruct());
Basically, I'd like to use the advantages of auto_ptr or scoped_ptr but with
ability to remove them from memory when they are not needed but function
didn't terminate yet.
I see there is a reset() - is that what I need?
in other words, how do i call auto_ptr or scoped_ptr destructor?
TStruct *a = new TStruct();
delete a;
but is it possible to delete this too:
std::auto_ptr<TStruct> a(new TStruct());
or this
boost::scoped_ptr<TStruct> a(new TStruct());
Basically, I'd like to use the advantages of auto_ptr or scoped_ptr but with
ability to remove them from memory when they are not needed but function
didn't terminate yet.
I see there is a reset() - is that what I need?
in other words, how do i call auto_ptr or scoped_ptr destructor?