Template NaturalComparable

Automatically generates natural-comparing opCmp, opEquals and toHash methods for a particular property or method. Methods must be @safe, nothrow, and const.

template NaturalComparable(alias T) ;

Example

struct SomeStruct {
	dstring someText;
	mixin NaturalComparable!someText;
}
struct SomeStructWithFunction {
	dstring _value;
	dstring something() const nothrow @safe {
		return _value;
	}
	mixin NaturalComparable!something;
}
assert(SomeStruct("100") > SomeStruct("2"));
assert(SomeStruct("100") == SomeStruct("100"));
assert(SomeStructWithFunction("100") > SomeStructWithFunction("2"));
assert(SomeStructWithFunction("100") == SomeStructWithFunction("100"));