mercredi 27 mars 2019

Error in converting argument from 'const_Ty' to const custom struct

I have a custom comparator and I pass in two const references of a custom struct to be compared, however, I get the 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;
};

Aucun commentaire:

Enregistrer un commentaire