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


i heard c++ enables overriding both operator== , operator!= because in cases a != b can implemented more efficient !(a == b).

i've thought , can't imagine case true.

what examples makes sense, performance-wise or other, have separate implementations operator== , operator!=?

the first example comes mind implementations analogous null value sql. in that, comparing 2 objects—either of null—does not mean equal. if both not null makes sense return equality.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -