opCmp

Free-function version of opCmp, useful to compare primitive scalar types in generic code.

pragma(inline)
int
opCmp
(
T
)
(
T lhs
,
T rhs
)
if (
__traits(isScalar, T)
)

Examples

assert( 2.opCmp(3)  < 0 );
assert( 3.opCmp(2)  > 0 );
assert( 2.opCmp(2) == 0 );
assert( 2.opCmp(3) != 0 );