title: unordered_set range insertion VS iterator
body: <p>I am trying to understand why range insertion below is faster than using the iterator.</p>
  
  <pre><code>vector&lt;string&gt; &amp;paths // 3 milion strings
  </code></pre>
  
  <p>Method 1 : range insert </p>
  
  <pre><code>unordered_set&lt;string&gt; mySet;
  mySet.insert(paths.begin(), paths.end());
  </code></pre>
  
  <p>Method 2 : iterator</p>
  
  <pre><code>vector&lt;string&gt;::iterator row;
  for (row = paths.begin(); row != paths.end(); row++)
  {
    mySet.insert(row[0]);
  }
  </code></pre>
  
  <p>Results :</p>
  
  <p>Method 1 : 753 ms</p>
  
  <p>Method 2 : 1221 ms</p>
  
  <p>==============================</p>
  
  <p>OS: Windows 10 </p>
  
  <p>IDE: visual studio code</p>
  
  <p>Compiler: gcc version 8.1.0 </p>
  
  <p>Flags : -O3</p>