Hi,
I have a code which looks like this:
class Parent
{
auto_ptr<Resource> ptr2Resc;
public: void parentMethod(int i )
{
SomeOtherClass someOthrPtr = new SomeOtherClass(ptr2Resc);
}
};
The ctor of SomeOtherClass:
SomeOtherClass(auto_ptr<Resource> ptrRes);
So now when i call parentMethod, the auto_ptr gets swapped and the ptr2Resc is dellocated. My C++ code doesn't support TR1 or Boost. So whats the best way to have the ptr2Resc deallocated during the Parent Class destructor, and not when it is passed as a parameter. Can i pass it as a reference to auto_ptr to the SomeOtherClass ctor?
Thanks