Handling a resource effectively using auto pointers
<p>I have a code which looks like this:</p>

<pre><code>class Parent
{
 auto_ptr&lt;Resource&gt; ptr2Resc;
 public: void parentMethod(int i )
{
 SomeOtherClass someOthrPtr = new SomeOtherClass(ptr2Resc); 
}
};

The ctor of SomeOtherClass:
SomeOtherClass(auto_ptr&lt;Resource&gt; ptrRes);
</code></pre>

<p>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?</p>

<p>Thanks </p>
