title: Using move semantics with std::pair or std::tuple
body: <p>Suppose you want to take advantage of move semantics, but one of your movable classes needs to be part of an <code>std::pair</code>.  The purpose would be to create a function that returns an <code>std::pair</code> that can be treated as an rvalue, and forwarded along. </p>
  
  <p>But I can't see how this can be done, unless an internal change to <code>std::pair</code> itself is made, to make it aware of move semantics.</p>
  
  <p>Consider the following code:</p>
  
  <pre><code>struct Foo
  {
   Foo() { }
  
   Foo(Foo&amp;&amp; f) { }
  
   private:
  
   Foo(const Foo&amp; f) { } // do not allow copying
  };
  
  int main() 
  {
   Foo f;
   std::pair&lt;Foo, int&gt; res = std::make_pair(f, 10); // fails due to private copy constructor
  }
  </code></pre>
  
  <p>The problem is that <code>std::make_pair</code>, as well as the <code>std::pair</code> constructor itself, takes two objects and tries to make internal copies of them.  This causes it to try and invoke the copy constructor.  But in my example, I want to be able to <em>move</em> the new pair into <code>res</code>, and ensure that no copies are made.  I would think this wouldn't be possible unless <code>std::pair</code> itself had the following constructor defined internally:</p>
  
  <pre><code>pair(T1&amp;&amp; t1, T2&amp;&amp; t2) : first(std::move(t1)), second(std::move(t2))
  </code></pre>
  
  <p>But it doesn't, at least not on the compiler I'm using (gcc 4.3.2).  It may be that my compiler is simply out-of-date, and newer versions in fact <em>will</em> have this move-aware constructor.  But my understanding of move semantics is somewhat flaky at the moment, so I'm not sure if I'm simply overlooking something here.  So, is what I'm trying to accomplish possible, without actually reimplementing <code>std::pair</code>?  Or is my compiler just out of date?</p>