title: How does the standard library implement std::swap?
body: <p>How is the swap function implemented in the STL? Is it as simple as this:</p>
  
  <pre><code>template&lt;typename T&gt; void swap(T&amp; t1, T&amp; t2) {
      T tmp(t1);
      t1=t2;
      t2=tmp;
  }
  </code></pre>
  
  <p>In other posts, they talk about specializing this function for your own class. Why would I need to do this? Why can't I use the <code>std::swap</code> function?</p>