title: When is a const reference better than pass-by-value in C++11?
body: <p>I have some pre-C++11 code in which I use <code>const</code> references to pass large parameters like <code>vector</code>'s a lot. An example is as follows:</p>
  
  <pre><code>int hd(const vector&lt;int&gt;&amp; a) {
     return a[0];
  }
  </code></pre>
  
  <p>I heard that with new C++11 features, you can pass the <code>vector</code> by value as follows without performance hits.</p>
  
  <pre><code>int hd(vector&lt;int&gt; a) {
     return a[0];
  }
  </code></pre>
  
  <p>For example, <a href="https://stackoverflow.com/a/2139254/683218">this answer</a> says</p>
  
  <blockquote>
    <p>C++11's move semantics make passing and returning by value much more attractive even for complex objects.</p>
  </blockquote>
  
  <p>Is it true that the above two options are the same performance-wise?</p>
  
  <p>If so, when is using const reference as in option 1 better than option 2? (i.e. why do we still need to use const references in C++11).</p>
  
  <p>One reason I ask is that const references complicate deduction of template parameters, and it would be a lot easier to use pass-by-value only, if it is the same with const reference performance-wise.</p>