comparePathsNatural

Compares path strings naturally. Comparing paths naturally requires path separators to be treated specially. Intended for usage in opCmp overloads.

nothrow @safe pure
int
comparePathsNatural
(
inout(char[]) pathA
,
inout(char[]) pathB
)
out (result) { assert (result <= 1, "Result too large"); assert (result >= -1, "Result too small"); }

Return Value

Type: int

-1 if a comes before b, 0 if a and b are equal, 1 if a comes after b

Examples

struct someStruct {
    string someText;
    int opCmp(someStruct b) {
         return comparePathsNatural(this.someText, b.someText);
    }
}

Meta