The Evil Within the Comparison Functions (C,C++,C#)
software.intel.com
software.intel.com
return less_helper(pt1, pt2)(&pt::x)(&pt::y);
with pt::x and pt::y being integers, this ends up the same size as the open-coded version on the clang versions I tested, but two instructions longer on the gcc versions I tested, because gcc does not succeed in eliminating a needless comparison of y<x. (x86_64 in both cases) This could be fixed by taking away the automatic conversion to bool and requiring the last comparison in the chain to specify that it IS the last one.