为什么必须是非成员函数
我把自定义的对象,放到优先队列中,priority_queue
默认的使用less<>比较器,为什么,我自定义的类的operator《必须是非成员的,如果是成员行数就会编译通不过
pq.cpp: In member function `bool _less<T>::operator()(T, T) [with T = test]':
pq.cpp:49: instantiated from here
pq.cpp:30: passing `const test' as `this' argument of `bool
test::operator<(test)' discards qualifiers