I just spent about an hour trying to figure out why I get 20 error messages like "Semantic issue - no matching function for call to 'swap'" when I try to build the next class (in Xcode).
test.h
#include <iostream> #include <string> #include <vector> class Test{ std::vector<std::string> list; void run() const; static bool algo(const std::string &str1, const std::string &str2); };
test.cpp
#include "test.h" void Test::run() const { std::sort( list.begin(), list.end(), algo ); } bool Test::algo(const std::string &str1, const std::string &str2){
Most people with the same problem seem to have made their algorithm a member of the class instead of a static member, but this is clearly not a problem.
c ++ sorting xcode compiler-errors
Badcash
source share