C++ - std::set constructor sometimes very inefficient?
<p>I am trying to construct a set in the following manner:</p>

<pre><code>    std::set&lt;SomeType&gt; mySet(aVector.begin(), aVector.end());
</code></pre>

<p>The performance of this line is very efficient in most cases. 10% of the time, I run into cases where this takes too long to run (over 600 milliseconds in some cases!). Why could that be happening? The inputs are very similar each time (the vector is for the most part sorted). Any ideas?</p>
