I have the following C++ classes:
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;
}
};
This is the build error:
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
I am using VS2019 Version 16.7.7. Any insight and advice is appreciated.