Why is “!=” used with iterators instead of “

All iterators are equality comparable. Only random access iterators are relationally comparable. Input iterators, forward iterators, and bidirectional iterators are not relationally comparable. Thus, the comparison using != is more generic and flexible than the comparison using <. There are different categories of iterators because not all ranges of elements have the same access properties. … Read more

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

JavaScript comparison operators: Identity vs. Equality

The equality operator will attempt to make the data types the same before making the comparison. On the other hand, the identity operator requires both data types to be the same as a prerequisite. There are quite a few other posts out there similar to this questions. See: How do the PHP equality (== double … Read more