自定义结构体
在定义set或者map之类时,自定义结构体需要一个排序规则,如下:
struct student { string names; int age; bool operator<(const student& other) const{ return age < other.age; } };
在定义set或者map之类时,自定义结构体需要一个排序规则,如下:
struct student { string names; int age; bool operator<(const student& other) const{ return age < other.age; } };
相关推荐