当我们使用std::sort的时,如果提供了比较函数,要注意比较函数需要满足一定条件,否则可能会引发crash。
错误范例:
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
bool cmp(const string& s1, const str
当我们使用std::sort的时,如果提供了比较函数,要注意比较函数需要满足一定条件,否则可能会引发crash。
错误范例:
#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
bool cmp(const string& s1, const str