mercredi 15 juin 2016

When does it make sense to have separate implementations for operator== and operator!=?


I heard C++ enables overriding both operator== and operator!= because in certain cases a != b can be implemented to be more efficient than !(a == b).

I've thought about this and can't imagine a case where this is true.

What are some examples where it makes sense, performance-wise or other, to have separate implementations for operator== and operator!=?


Aucun commentaire:

Enregistrer un commentaire