import std.meta : AliasSeq; static foreach (Scalar; AliasSeq!(char, ubyte, int, size_t, float, double)) {{ const Scalar two = 2; const Scalar three = 3; assert( opCmp(two, three) < 0 ); assert( opCmp(three, two) > 0 ); assert( opCmp(two, two) == 0 ); assert( opCmp(two, three) != 0 ); }}
Free-function version of opCmp for generic code.
Can be used to efficiently compare both complex types with a custom opCmp, or primitive types.