title: moving unique pointers between deques
body: <p>I have a container class for some unique pointers to objects.</p>
  
  <p>I now need to take one of them, do something with them in a different class and hand over to another class (and at some point recycle them and put them back to the container ).</p>
  
  <p>Below is the outline of the code. However I am getting confused with the right way to move unique pointers with functions:</p>
  
  <pre><code>using uptrPod =  unique_ptr&lt;Pod&gt;;
  using dqUptrPods = deque&lt;uptrPods&gt;;
  
  class Container {
  public:
      Container() :
          n_elements_( 500 )
      {
          for ( auto i = 0; i &lt; n_elements_; i++ ) {
          free_pods_.push_back( uptrPod( new Pod()) );
      }
  
      const uptrPod&amp;&amp; getPod() {
          auto up_pod= std::move( free_pods_[0] );
          free_pods_.erase( free_pods_.begin() );
          return up_pod;
      }
  
      void returnPod( const uptrPod&amp;&amp; up_pod ) {
          free_pods_.push_back( up_pod );
      }
  
  private:
      long n_elements_;
      dqUptrPods free_pods_;
  };
  
  class PodTracker {
  
      void addPod( const uptrPod&amp;&amp; up_pod ) { dq_pods_.pushback( up_pod ); }
      dqUptrPods dq_pods_;
  };
  
  class PodHandler {
  
      void movePod() {
          up_pod = std::move( container_-&gt;getPod() );
  
          /// do stuff with pod
  
          pod_tracker_-&gt;addPod( up_pod );
      }
  
      Container* container_;
      PodTracker* pod_tracker_;
  };
  </code></pre>
  
  <p>I am getting the error:</p>
  
  <blockquote>
    <p>cannot bind std::unique_ptr l value to const uptrPod&amp;&amp; { aka const std::unique_ptr &amp;&amp;</p>
  </blockquote>
  
  <p>How can I hand around the pointer between the classes?</p>