Chaining of ordering predicates (e.g. for std::sort)
问题 You can pass a function pointer, function object (or boost lambda) to std::sort to define a strict weak ordering of the elements of the container you want sorted. However, sometimes (enough that I've hit this several times), you want to be able to chain "primitive" comparisons. A trivial example would be if you were sorting a collection of objects that represent contact data. Sometimes you will want to sort by last name, first name, area code . Other times first name, last name - yet other