title: Does STL sort use swap or binary copy?
body: <p>I'm having trouble finding a good answer to this. For some reason I thought STL sort would be implemented using swap for better support of complicated types, but as I ended up digging through the code a bit it appears it is actually doing a binary copy. Can someone confirm this? I guess binary copy would actually be preferred to swap.</p>
  
  <p><em>Side Question</em>: Are any of the STL algorithms or container operations implemented using swap? (Outside of <code>std::swap</code> obviously.) I want to be aware of when it is prudent to implement my own swap for complicated types.</p>
  
  <p>Edit: Reason I'm asking is if you have something like:</p>
  
  <pre><code>class MyClass {
    vector&lt;int&gt; vec_data;
    int a;
    int b;
  }
  vector&lt;MyClass&gt; my_vec;
  sort(my_vec.begin(), my_vec.end(), MyCustomCompare);
  </code></pre>
  
  <p>I want to make sure the sort isn't calling the copy constructor of the vector, which would happen if you called the default Copy constructor of MyData. Hence my question is sort calling swap, copy assign, etc?</p>