title: What does auto&& do?
body: <p>This is the code from C++11 Notes Sample by Scott Meyers, </p>
  
  <pre><code>int x;
  auto&amp;&amp; a1 = x;             // x is lvalue, so type of a1 is int&amp;
  auto&amp;&amp; a2 = std::move(x);  // std::move(x) is rvalue, so type of a2 is int&amp;&amp;
  </code></pre>
  
  <p>I am having trouble understanding <code>auto&amp;&amp;</code>.<br>
  I have some understanding of <code>auto</code>, from which I would say that <code>auto&amp; a1 = x</code> should make type of <code>a1</code> as <code>int&amp;</code></p>
  
  <p>Which from Quoted code, seems wrong.</p>
  
  <p>I wrote this small code, and ran under gcc.</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  int main()
  {
      int x = 4;
      auto&amp; a1 = x;           //line 8
      cout &lt;&lt; a1 &lt;&lt; endl;
      ++a1;
      cout &lt;&lt; x;
      return 0;
  }
  </code></pre>
  
  <p>Output = <code>4 (newline) 5</code><br>
  Then I modified line 8 as <code>auto&amp;&amp; a1 = x;</code>, and ran. Same output.</p>
  
  <p>My question : Is <code>auto&amp;</code> equal to <code>auto&amp;&amp;</code>?<br>
  If they are different what does <code>auto&amp;&amp;</code> do?</p>