I got this error message from the compiler: no match for ‘operator<’ (operand types are ‘const VP’ and ‘const VP’).
The problem is I actually implemented it. Here is my VP class.
I just want to use the VP for a priority_queue.
1 2 3 4 5 6 7 8 9 10 11
class VP // Value Priority
{
public:
VP(int Value, int Priority): value(Value), priority(Priority) {};
booloperator< (const VP& vp){
return priority < vp.priority ||
(priority == vp.priority && value < vp.value);
}
int value;
int priority;
};
More details about the error message:
/usr/include/c++/7/bits/stl_function.h:386:20: error: no match for ‘operator<’ (operand types are ‘const VP’ and ‘const VP’)
{ return __x < __y; }
~~~~^~~~~
In file included from TLB.cpp:1:0:
TLB.h:29:14: note: candidate: bool VP::operator<(const VP&) <near match>
bool operator< (const VP& vp)