title: Meaning of auto& :
body: <p>I understand that auto means type deduction.  I've never seen it used as <code>auto&amp;</code> and furthermore I don't understand what <code>:</code> is doing in this short code. </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  #include &lt;thread&gt;
  
  void PrintMe() {
      std::cout &lt;&lt; "Hello from thread: " &lt;&lt; std::this_thread::get_id() &lt;&lt; std::endl;
  }
  
  int main() {
      std::vector&lt;std::thread&gt; threads;
      for(unsigned int i = 0; i &lt; 5; i++) {
          threads.push_back(std::thread(PrintMe));
      }
  
      for(auto&amp; thread : threads) {
          thread.join();
      }
  
      return 0;
  }
  </code></pre>
  
  <p>I can guess this is some sort of syntatic sugar that replaces</p>
  
  <pre><code>for(std::vector&lt;std::thread&gt;::iterator it = threads.begin(); it != threads.end(); it++ ) {
      (*it).join();
  }
  </code></pre>
  
  <p>but I don't understand how this syntax works and what that &amp; sign is doing there.</p>