1-set的使用.cpp
#include <iostream>
#include <set>
using namespace std;
class Student
{
private:
int id;
string name;
public:
Student(int i, string n);
void show()const;
bool operator<(const Student &s) const;
bool operator>(const Student &s) const;
};
Student::Student(int i, string n)
{
id = i;
name = n;
}
void Student::show() const
{
cout << "id " << id << " name " << name << endl;
}
bool Student::operator<(const Student &s) const
{
return this->id < s.id;
}
bool Student::operator>(const Student &s) const
{
return this->id