title: Overloading global swap for user-defined type
body: <p>The C++ standard prohibits declaring types or defining anything in namespace <code>std</code>, but it does allow you to specialize standard STL templates for user-defined types.</p>
  
  <p>Usually, when I want to specialize <code>std::swap</code> for my own custom templated type, I just do:</p>
  
  <pre><code>namespace std
  {
    template &lt;class T&gt;
    void swap(MyType&lt;T&gt;&amp; t1, MyType&lt;T&gt;&amp; t2)
    {
       t1.swap(t2);
    }
  }
  </code></pre>
  
  <p>...and that works out fine.  But I'm not entirely sure if my usual practice is standard compliant.  Am I doing this correctly?</p>