I have a custom comparator and I pass in two const references of a custom struct to be compared, however, I get the following error:
'bool cmp::operator()(const LogObjects &, const LogObjects &)' cannot convert argument 2 from 'const_Ty' to 'const LogObjects &'.
I've tried adding and removing const, and references but it didn't work.
bool cmp::operator()(const LogObjects &a, const LogObjects &b) { // body }
struct LogObjects {
string category;
string message;
string timestamp;
long long int time;
int entry_id;
sort(master.begin(), master.end(), cmp());
auto it1 = lower_bound(master.begin(), master.end(), time, cmp());
auto it2 = upper_bound(master.begin(), master.end(), time, cmp());
};
(master is a vector of LogObjects and time is a long long int)