title: sort() - No matching function for call to 'swap'
body: <p>Just spent about an hour trying to figure out why I would get 20 error messages of the type <code>"Semantic issue - no matching function for call to 'swap'"</code> when I try to build the following class (in XCode).</p>
  
  <p><strong>test.h</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;vector&gt;
  
  
  class Test{
      std::vector&lt;std::string&gt; list;
  
      void run() const;
      static bool algo(const std::string &amp;str1, const std::string &amp;str2);
  };
  </code></pre>
  
  <p><strong>test.cpp</strong></p>
  
  <pre><code>#include "test.h"
  
  
  void Test::run() const {
      std::sort( list.begin(), list.end(), algo );
  }
  
  
  bool Test::algo(const std::string &amp;str1, const std::string &amp;str2){
      // Compare and return bool
  }
  </code></pre>
  
  <p>Most of the people with the same problem seem to have made their algorithm a class member instead of a static member, but that is clearly not the problem here.</p>