Use char ranges to avoid compilation errors on elder compilers
This commit is contained in:
parent
29d883150e
commit
36dad80e18
@ -1432,15 +1432,15 @@ struct String
|
|||||||
}
|
}
|
||||||
body
|
body
|
||||||
{
|
{
|
||||||
const oldLen = length;
|
auto oldLen = this.data + length;
|
||||||
const offset = r.end - this.data;
|
|
||||||
const inserted = insertBack(el);
|
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;
|
return inserted;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// bringToFront before 2.073 isn't @nogc for chars.
|
///
|
||||||
@safe unittest
|
@safe @nogc unittest
|
||||||
{
|
{
|
||||||
auto s = String("Нельзя казнить помиловать.");
|
auto s = String("Нельзя казнить помиловать.");
|
||||||
s.insertAfter(s[0 .. 27], ",");
|
s.insertAfter(s[0 .. 27], ",");
|
||||||
@ -1469,7 +1469,7 @@ struct String
|
|||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
@safe unittest
|
@safe @nogc unittest
|
||||||
{
|
{
|
||||||
auto s = String("Нельзя казнить помиловать.");
|
auto s = String("Нельзя казнить помиловать.");
|
||||||
s.insertBefore(s[27 .. $], ",");
|
s.insertBefore(s[27 .. $], ",");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user