title: Why did the range based 'for' loop specification change in C++17?
body: <p>I was looking over some ugly code (that was modifying the underlying sequence while iterating), and to explore the definition of the range-based <code>for</code> loop, I went to <a href="https://en.cppreference.com/w/cpp/language/range-for" rel="noreferrer">cppreference</a>. </p>
  
  <p>There I noticed something strange:</p>
  
  <p>The range based <code>for</code> loop changed in C++17, but I do not see the reason for the change, and the code looks the same to me (just "refactored").
  So the old one was:</p>
  
  <pre><code>{
    auto &amp;&amp; __range = range_expression;
    for (auto __begin = begin_expr, __end = end_expr; __begin != __end; ++__begin) {
      range_declaration = *__begin;
      loop_statement
    }
  } 
  </code></pre>
  
  <p>The new one is</p>
  
  <pre><code>{
    auto &amp;&amp; __range = range_expression;
    auto __begin = begin_expr;
    auto __end = end_expr;
    for ( ; __begin != __end; ++__begin) {
      range_declaration = *__begin;
      loop_statement
    }
  } 
  </code></pre>
  
  <p>Why was this change made, and does it make any legal C++14 programs exhibit undefined behavior (<a href="https://stackoverflow.com/questions/2766731/what-exactly-do-ib-and-ub-mean">UB</a>) in C++17?</p>