title: Why does unordered_set::begin() change if no rehashing occurs?
body: <p>Based on reading <a href="https://en.cppreference.com/w/cpp/container/unordered_set/emplace" rel="nofollow noreferrer">https://en.cppreference.com/w/cpp/container/unordered_set/emplace</a>, it states: Rehashing occurs only if the new number of elements is greater than max_load_factor()*bucket_count().</p>
  
  <p>In this code:</p>
  
  <pre><code>int main() 
  { 
      unordered_set&lt;int&gt; myset;
      myset.emplace(4);
      cout &lt;&lt; myset.bucket_count() &lt;&lt; endl;
      cout &lt;&lt; myset.max_load_factor() &lt;&lt; endl;
  
      auto it = myset.begin();
      myset.emplace(3);
      cout &lt;&lt; (it == myset.begin()) &lt;&lt; endl;
  }
  </code></pre>
  
  <p>There is no rehashing when I do emplace the second time (bucket count is 2 and max load factor is 1 right before emplacing the second time, which is not more than the new number of elements, 2), but my <code>begin()</code> iterator changes. Why is this iterator invalidated/changed even though there is no rehashing? </p>