From 36dad80e182434d827bf806c8c1439aa8d2b96d9 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Fri, 12 May 2017 21:46:48 +0200 Subject: [PATCH] Use char ranges to avoid compilation errors on elder compilers --- source/tanya/container/string.d | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/tanya/container/string.d b/source/tanya/container/string.d index 435b7b5..2e51a04 100644 --- a/source/tanya/container/string.d +++ b/source/tanya/container/string.d @@ -1432,15 +1432,15 @@ struct String } body { - const oldLen = length; - const offset = r.end - this.data; + auto oldLen = this.data + length; const inserted = insertBack(el); - bringToFront(this.data[offset .. oldLen], this.data[oldLen .. length]); + bringToFront(ByCodeUnit!char(this, r.end, oldLen), + ByCodeUnit!char(this, oldLen, this.data + length)); return inserted; } - /// bringToFront before 2.073 isn't @nogc for chars. - @safe unittest + /// + @safe @nogc unittest { auto s = String("Нельзя казнить помиловать."); s.insertAfter(s[0 .. 27], ","); @@ -1469,7 +1469,7 @@ struct String } /// - @safe unittest + @safe @nogc unittest { auto s = String("Нельзя казнить помиловать."); s.insertBefore(s[27 .. $], ",");