The reason is that just writing !pred(*first)
could result in a call to an overloaded operator!
rather than the call to explicit operator bool
.
It’s interesting that this measure was taken for pred
, but an overloaded operator&&
can still be selected in the implementation provided. first != last
would need to be changed to bool(first != last)
to also prevent this overload.