title: c++11 Return value optimization or move?
body: <p>I don't understand when I should use <code>std::move</code> and when I should let the compiler optimize... for example:</p>
  
  <pre><code>using SerialBuffer = vector&lt; unsigned char &gt;;
  
  // let compiler optimize it
  SerialBuffer read( size_t size ) const
  {
      SerialBuffer buffer( size );
      read( begin( buffer ), end( buffer ) );
      // Return Value Optimization
      return buffer;
  }
  
  // explicit move
  SerialBuffer read( size_t size ) const
  {
      SerialBuffer buffer( size );
      read( begin( buffer ), end( buffer ) );
      return move( buffer );
  }
  </code></pre>
  
  <p>Which should I use?</p>