问题描述
我有以下C ++类:
class MyClass {
private:
int _id;
unsigned long long _timestamp;
public:
MyClass(int id,unsigned long long ts) : _id(id),_timestamp(ts) {}
bool operator<(const MyClass& other) const { return _timestamp < other._timestamp; }
int GetID() {return _id;}
};
class MyClass1 {
private:
map<int,multiset<MyClass>> _list;
public:
vector<int> GetMyClasses(int id,int count) {
vector<int> result;
transform(_list[id].rbegin(),_list[id].rbegin() + count,back_inserter(result),[](const MyClass& c) {return c.GetID();});
return result;
}
};
这是构建错误:
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include\xutility(1915,41): error C2676: binary '-': 'const _BidIt' does not define this operator or a conversion to a type acceptable to the predefined operator
我正在使用VS2019版本16.7.7。任何见解和建议都将受到赞赏。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)