operator< comparing multiple fields
I’d like to do it all by myself.. You should only compare the values of Obj::field2 if the values of Obj::field1 are equal. The easy-to-understand way: /* This will meet the requirements of Strict-Weak-Ordering */ if (a.field1 != b.field1) return a.field1 < b.field1; else return a.field2 < b.field2; The correct (recommended) way: The “correct” way … Read more