이렇게 하면은 원하는대로 sorting할 수 있음
class fishInfo{
public:
int row, col, size;
fishInfo(int row, int col, int size): row(row),col(col),size(size){}
//연산자 오버로딩
bool operator<(fishInfo f) const{
if(this->size == f.size){
return this->row < f.row;
}else{
return this->size < f.size;
}
}
};
vector<fishInfo> fishes;
sort(fishes.begin(), fishes.end());
for(int i = 0; i < fishes.size(); i++)
cout << fishes[i].size << endl;