I've read in a book of c++ algorithms about overloading operators and I have a problem understanding how overloading operator works in that case. This is the sequence of code:
struct cmp {
bool operator () (const int &x, const int &y) const
{
return x % 17 < y % 17;
}
};
int main() {
priority_queue<int, vector<int>, cmp> note;
note.push(80); note.push(97); note.push(100); note.push(30);
while ( note.size() > 0 )
{
cout << note.top() << " ";
note.pop();
}
return 0;
}
What I don't understand is this line of code:
bool operator () (const int &x, const int &y) const
Please someone help me!