In "The C++ Standard Library" by Nicolai M. Josuttis (10th Printing December 2002), section 8.1.1 "Function Objects as Sorting Criteria" has operator() with return statement:
return p1.lastname()<p2.lastname() ||
(!(p2.lastname()<p1.lastname()) &&
p1.firstname()<p2.firstname());
Which, based on my understanding of equivalence is correct. But the second edition of that same book (published in 2012) has changed it to:
return p1.lastname()<p2.lastname() ||
(p1.lastname()==p2.lastname() &&
p1.firstname()<p2.firstname());
which uses a blend of equivalence and equality. The errata for the 1st edition confirms the second edition is correct: http://www.josuttis.com/libbook/errata1_05.html (see Page 295, Section 8.1.1)
Why is the first incorrect? I thought for equivalence that two values were equivalent if neither precedes the other which is what the first code snippet shows. And why is the second correct even though it's employing operator== which is a test for equality, not equivalence?
ps. The second edition has this in section 10.1.1 with same section heading as first edition.