I would like to create a set containing the objects of my class, I have to determine a custom comparison. Unfortunately, everything I tried did not work.
class My_Class {
public:
char letter;
set<My_Class, compare> Children;
};
Ant then, the compare struct:
struct compare {
bool operator() (const My_Class& a, const My_Class& b) const{
return a.letter < b.letter;
}
};
How can I make this work please?
Currently, the issue displays that identifiers a
and b
are not declared.