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.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…