6.17 Custom Comparators
6.17 Custom Comparators Sorting depends on a comparison relation. A custom comparator defines that relation for user-defined types and nontrivial ordering rules. The correctness of a sort relies on the comparator being consistent. When the comparator is inconsistent, the algorithm may produce incorrect output or fail to terminate. Problem You have elements that are not naturally ordered, or you need an order different from the default. You want to sort...