Listing 2: Definition and usage of a compound-comparison function object
//in person.h struct less_last_first_id { bool operator()(person const &lh, person const &rh) const {return ((lh.last_ < rh.last_)?(true): ((lh.last_ > rh.last_)?(false): ((lh.first_ < rh.first_)?(true): ((lh.first_ > rh.first_)?(false): ((lh.id_ < rh.id_)?(true): ((lh.id_ > rh.id_)?(false): (false)))))));} }; //usage std::sort(people.begin(), people.end(), less_last_first_id());