title: Will RVO happen when returning std::pair?
body: <p>A function needs to return two values to the caller. What is the best way to implement?</p>
  
  <p>Option 1:</p>
  
  <pre><code>pair&lt;U,V&gt; myfunc()
  {
  ...
  return make_pair(getU(),getV());
  }
  
  pair&lt;U,V&gt; mypair = myfunc();
  </code></pre>
  
  <p>Option 1.1:</p>
  
  <pre><code>// Same defn
  U u; V v;
  tie(u,v) = myfunc();
  </code></pre>
  
  <p>Option 2:</p>
  
  <pre><code>void myfunc(U&amp; u , V&amp; v)
  {
  u = getU(); v= getV();
  }
  
  U u; V v;
  myfunc(u,v);
  </code></pre>
  
  <p>I know with Option2, there are no copies/moves but it looks ugly. Will there be any copies/moves occur in Option1, 1.1? Lets assume U and V are huge objects supporting both copy/move operations.</p>
  
  <p>Q: Is it theoretically possible for any RVO/NRVO optimizations as per the standard? If yes, has gcc or any other compiler implemented yet?</p>