title: How do use a std::auto_ptr in a class you have to copy construct?
body: <p>I have class <code>foo</code> that contains a std::auto_ptr member that I would like to copy construct but this does not appear to be allowed. There's a similar thing for the assignment. See the following example:</p>
  
  <pre><code>struct foo
  {
  private:
      int _a;
      std::string _b;
      std::auto_ptr&lt; bar &gt; _c;
  
  public:
      foo(const foo&amp; rhs)
          :   _a(rhs._a)
          ,   _b(rhs._b)
  
          ,   _c(rhs._c)
                  // error: Cannot mutate rhs._c to give up ownership - D'Oh!
      {
      }
  
      foo&amp; operator=(const foo&amp; rhs)
      {
           _a = rhs._a;
           _b = rhs._b;
  
           _c = rhs._c;
               // error: Same problem again.
      }
  };
  </code></pre>
  
  <p>I could just declare <code>_c</code> as <code>mutable</code> but I'm not sure this is correct. Does anyone have a better solution?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>OK, I'm not getting the kind of answer that I was expecting so I'll be a little more specific about the problem.</p>
  
  <ul>
  <li>An object of type <code>foo</code> is created on the stack and passed by value into a container class (not stl) and then goes out of scope. I don't have any control over the container code. (It's actually an active queue implementation, with bugs.)</li>
  <li>The <code>bar</code> class is a fairly heavyweight parser. It has very poor performance on <code>new</code> and <code>delete</code> so even if it was copy constructable, it would be way too expensive.</li>
  <li>We can guarantee that when a <code>bar</code> object is created, it will only ever need to be owned in 1 place at a time. In this case it is being passed between threads and deleted when the transaction is completed. This is why I was hoping to use a <code>std::autp_ptr</code>.</li>
  <li>I am very willing to consider boost smart pointers but I was hoping to guarantee this uniqueness if there is an alternative.</li>
  </ul>