I am using the BOOST_STRONG_TYPEDEF
macro, which creates a class that overloads operator==
. I'm wondering if I need to overload operator!=
as well?
Answer: no!
The reason (that I didn't notice at first) is that BOOST_STRONG_TYPEDEF uses Boost operators (http://www.boost.org/doc/libs/1_38_0/libs/utility/operators.htm), specifically totally_ordered1 and totally_ordered2. So the less than and equality comparison operators are implemented for you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With