vs2017,在给set规定排序规则是出现c2664错误是为啥?

class person
{
public:
    person(string name, int age)
    {
        this->name = name;
        this->age = age;
    }
    void pirnt_person() const
    {
        cout << this->name << " " << this->age << endl;
    }
    string name;
    int age;
};
class Mycompare07
{
public:
    bool operator() (person& p1, person& p2)
    {
        return p1.age > p2.age;
    }
};
void test07()//自定义类型存入set必须规定排序规则
{
    person p1("aaa", 34);
    person p2("bbb", 43);
    person p3("ccc", 25);
    person p4("ddd", 62);
    person p5("eee", 15);
    set<person, Mycompare07> s1;
    s1.insert(p1);
    s1.insert(p2);
    s1.insert(p3);
    s1.insert(p4);
    s1.insert(p5);
    for (set<person, Mycompare07>::iterator it = s1.begin(); it != s1.end(); it++)
        (*it).pirnt_person();
    cout << endl;
}

在以上代码的中,规定set排序规则的仿函数中,使用 & 就会报c2664的错误,请问是为什么?
若将

class Mycompare07
{
public:
    bool operator() (person& p1, person& p2)
    {
        return p1.age > p2.age;
    }
};

中的 & 去除,则不会报错

可能是空格问题,你的&与person连接了,把空格移到&前,改为person &p1试一下。(不行不要怪我哦)

person 前面加个const试试

c2664错误就是参数类型不匹配。你自己已经说了, & 去除,则不会报错