title: Moving an object from one unique_ptr to another C++
body: <p>I've created 2 classes: <code>Crane</code> and <code>Container</code>. <code>Crane</code> has a private member <code>unique_ptr&lt;Container&gt; container</code> and a public method <code>load()</code> taking a <code>unique_ptr&lt;Container&gt;</code> as a parameter, like this:</p>
  
  <pre><code>void Crane::load(unique_ptr&lt;Container&gt; container)
  {
      if(isUnloaded())
      {
          this-&gt;container = move(container);
      }
  }
  </code></pre>
  
  <p>My goal here is to give a crane a container to hold, so other <code>Crane</code> methods can put the currently held container down in a warehouse, check its id, weight, etc. </p>
  
  <p>Now, in <code>main()</code> I create 2 objects: <code>Crane crane;</code> and <code>unique_ptr&lt;Container&gt; con(new Container(1));</code>.</p>
  
  <p>In <code>main()</code>, when I want to call <code>crane.load(con)</code>, I get this error:</p>
  
  <blockquote>
    <p>error: use of deleted function 'std::unique_ptr&lt;_Tp, _Dp>::unique_ptr(const std::unique_ptr&lt;_Tp, _Dp>&amp;) [with _Tp = Container; _Dp = std::default_delete&lt;Container>]'</p>
  </blockquote>
  
  <p>I thought that this is the way when you want to change ownership of an object?  Please help.</p>