You are viewing a single comment's thread. Return to all comments →
just for fun with ternary
bool compare(const Player& p1,const Player& p2) { return p1.score > p2.score ? true : (p1.score == p2.score ? p1.name < p2.name : false); } vector<Player> comparator(vector<Player> players) { sort(players.begin(), players.end(), compare); return players; }
Sorting: Comparator
You are viewing a single comment's thread. Return to all comments →
just for fun with ternary