diff options
| author | Eugen Wissner <belka@caraus.de> | 2017-05-01 20:17:37 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2017-05-01 20:17:37 +0200 |
| commit | 16cf8478cf3940e1d792a4ddd7358f439ea9c53a (patch) | |
| tree | c1f409644787d29746da110b98011bd4d5ee4945 | |
| parent | 8915a0c7a7b1a0701da7662a6ca96aa9dbcda16d (diff) | |
| download | tanya-16cf8478cf3940e1d792a4ddd7358f439ea9c53a.tar.gz | |
Add ByCodePoint
| -rw-r--r-- | source/tanya/container/string.d | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/source/tanya/container/string.d b/source/tanya/container/string.d index 61c6628..91830f2 100644 --- a/source/tanya/container/string.d +++ b/source/tanya/container/string.d @@ -1116,6 +1116,7 @@ struct String * Comparison for equality. * * Params: + * S = Right hand side type. * that = The string to compare with. * * Returns: A positive number if $(D_KEYWORD this) is lexicographically @@ -1127,26 +1128,17 @@ struct String return cmp(this.data[0 .. length], that.data[0 .. that.length]); } - /** - * Comparison for equality. - * - * Params: - * R = Right hand side type. - * that = Right hand side string range. - * - * Returns: A positive number if $(D_KEYWORD this) is lexicographically - * greater than $(D_PARAM that), if equal `0`, else `-1`. - */ - int opCmp(E)(ByCodeUnit!E that) const @trusted - if (is(Unqual!E == char)) + /// Ditto. + int opCmp(S)(ByCodeUnit!S that) const @trusted + if (is(Unqual!S == char)) { return cmp(this.data[0 .. length], that.begin[0 .. that.end - that.begin]); } /// Ditto. - int opCmp(E)(ByCodePoint!E that) const @trusted - if (is(Unqual!E == char)) + int opCmp(S)(ByCodePoint!S that) const @trusted + if (is(Unqual!S == char)) { return cmp(this.data[0 .. length], that.begin[0 .. that.end - that.begin]); @@ -1169,6 +1161,7 @@ struct String * Comparison for equality. * * Params: + * S = Right hand side type. * that = The string to compare with. * * Returns: $(D_KEYWORD true) if the strings are equal, $(D_KEYWORD false) @@ -1184,22 +1177,21 @@ struct String * Comparison for equality. * * Params: - * R = Right hand side type. * that = Right hand side string range. * * Returns: $(D_KEYWORD true) if the string and the range are equal, * $(D_KEYWORD false) otherwise. */ - bool opEquals(E)(ByCodeUnit!E that) const @trusted - if (is(Unqual!E == char)) + bool opEquals(S)(ByCodeUnit!S that) const @trusted + if (is(Unqual!S == char)) { return equal(this.data[0 .. length], that.begin[0 .. that.end - that.begin]); } /// Ditto. - bool opEquals(E)(ByCodePoint!E that) const @trusted - if (is(Unqual!E == char)) + bool opEquals(S)(ByCodePoint!S that) const @trusted + if (is(Unqual!S == char)) { return equal(this.data[0 .. length], that.begin[0 .. that.end - that.begin]); |
