title: Use vector<int>::iterator by reference but with error
body: <pre><code>#include&lt;vector&gt;
  #include&lt;iostream&gt;
  using namespace std;
  
  int main()
  {
      vector&lt;int&gt; vec = {1,2,3,4};
      for(auto &amp; it = vec.begin(); it != vec.end(); ++it)
      {
          cout &lt;&lt; *it &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>Hello all, in C++ I use iterator by reference such as "auto &amp; it" and the compiler return the error </p>
  
  <blockquote>
    <p>" error: invalid initialization of non-const reference of type '__gnu_cxx::__normal_iterator >&amp;' from an rvalue of type 'std::vector::iterator {aka __gnu_cxx::__normal_iterator >}'
         for(auto &amp; it = vec.begin(); it != vec.end(); ++it)
    ".</p>
  </blockquote>
  
  <p>I know "auto it = vec.begin()" works fine but as we all know pass by reference will improve the efficiency in C++, so why this error occurs when I use "auto &amp; it"? </p>