
I have been bitten in the past by operator<. I was converting code that used unsigned with a 'magic value' to represent nullness to boost::optionalstd::uint32_t. However, the maximum value it used was std::numeric_limitsstd::uint32_t:max(). A simple find and replace for this magic constant (which was referred to everywhere as DWORD_NULL) with boost::none and fixing compile errors led to some erroneous code. We had code that assumed an 'uninitialized' std::uint32_t was greater than any valid value. The concept of "value not present" is not inherently less-than or greater-than any value, but because of operator<, code compiled that shouldn't have. I suppose this is really an argument against any operator< overload, not just the mixed-type comparison. I don't expect this to be a major problem for new code, but there is a lot of code out there that uses a magic value, and that is what optional is supposed to replace.