5
使用自定义的std :: set比较器
Наэтотвопросестьответына 堆栈溢出нарусском:Компаратордля集 我试图将一组整数中的项目的默认顺序更改为字典式而不是数字式,并且无法使用g ++进行以下编译: file.cpp: bool lex_compare(const int64_t &a, const int64_t &b) { stringstream s1,s2; s1 << a; s2 << b; return s1.str() < s2.str(); } void foo() { set<int64_t, lex_compare> s; s.insert(1); ... } 我收到以下错误: error: type/value mismatch at argument 2 in template parameter list for ‘template<class _Key, class …