#include <iostream>
#include <string>
#include <map>
using namespace std;
class Student
{
public:
string name;
string id;
int age;
bool operator()(const Student& s1, const Student& s2)
{
if (s1.name == s2.name)
{
if (s1.id == s2.id)
{
return s1.age > s2.age;
}
else
{
return s1.id > s2.id;
}
}
else
{
return s1.name > s2.name;
}
}
};
int main()
{
map<Student, int>m;
return 0;
}
假如map类m的key值是一个Student类,现在已经重载比较运算符了,如果给出name或者id或者age,该怎么根据给出的关键字来在m中进行哈希查找?