title: How do I transfer ownership of a unique_ptr when returning a tuple?
body: <p>I'm trying to return a tuple, one of the elements of which is a <code>std::unique_ptr</code>.  I want to transfer the ownership of the <code>unique_ptr</code> to the caller.  How do I do this?</p>
  
  <pre><code>#include &lt;tuple&gt;
  #include &lt;memory&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  class B
  {
  public:
      B(int i) : i_(i) {}
  
      int getI() const { return i_; }
  private:
     int i_;
  };
  
  tuple&lt;unique_ptr&lt;B&gt;, int&gt;
  getThem()
  {
      unique_ptr&lt;B&gt; ptr(new B(10));
      return make_tuple(ptr, 50);
  }
  
  int
  main(int argc, char *argv[])
  {
  
      unique_ptr&lt;B&gt; b;
      int got = 0;
  
      tie(b, got) = getThem();
  
      cout &lt;&lt; "b: " &lt;&lt; b-&gt;getI() &lt;&lt; endl;
      cout &lt;&lt; "got: " &lt;&lt; got &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>This fails to compile because the copy constructor of <code>unique_ptr</code> is deleted, for obvious reasons.  But how to I indicate I want to move the <code>unique_ptr</code> into the <code>tie</code>?</p>