Wednesday 15 January 2014

c++ - Test for equivalence with only less than operator? -



c++ - Test for equivalence with only less than operator? -

say have 2 literals of type 't'. i'd test if equivalent, type 't' has "less than" operator implemented. how able test in c++?

you can emulate equality operator couple of "less than" comparisons , negation:

if (!(t1 < t2) && !(t2 < t1)) { printf ("t1 , t2 equivalent"); }

c++ comparison operator-keyword equivalence

No comments:

Post a Comment