Replace immutable with const in Vector

This commit is contained in:
Eugen Wissner 2017-05-12 20:35:16 +02:00
parent d4ab339feb
commit 001c7c3e33

View File

@ -483,7 +483,7 @@ struct Vector(T)
return; return;
} }
bool overflow; bool overflow;
immutable byteSize = mulu(size, T.sizeof, overflow); const byteSize = mulu(size, T.sizeof, overflow);
assert(!overflow); assert(!overflow);
void[] buf = this.data[0 .. this.capacity_]; void[] buf = this.data[0 .. this.capacity_];
@ -540,7 +540,7 @@ struct Vector(T)
{ {
return; return;
} }
immutable n = max(length, size); const n = max(length, size);
void[] buf = this.data[0 .. this.capacity_]; void[] buf = this.data[0 .. this.capacity_];
if (allocator.reallocateInPlace(buf, n * T.sizeof)) if (allocator.reallocateInPlace(buf, n * T.sizeof))
{ {
@ -606,7 +606,7 @@ struct Vector(T)
} }
body body
{ {
immutable toRemove = min(howMany, length); const toRemove = min(howMany, length);
length = length - toRemove; length = length - toRemove;
@ -797,9 +797,9 @@ struct Vector(T)
} }
body body
{ {
immutable oldLen = length; const oldLen = length;
immutable offset = r.end - this.data; const offset = r.end - this.data;
immutable inserted = insertBack(el); const inserted = insertBack(el);
bringToFront(this.data[offset .. oldLen], this.data[oldLen .. length]); bringToFront(this.data[offset .. oldLen], this.data[oldLen .. length]);
return inserted; return inserted;
} }
@ -828,8 +828,8 @@ struct Vector(T)
} }
body body
{ {
immutable oldLen = length; const oldLen = length;
immutable offset = r.end - this.data; const offset = r.end - this.data;
static if (__traits(isRef, el)) static if (__traits(isRef, el))
{ {
@ -884,8 +884,8 @@ struct Vector(T)
} }
body body
{ {
immutable oldLen = length; const oldLen = length;
immutable offset = r.begin - this.data; const offset = r.begin - this.data;
static if (__traits(isRef, el)) static if (__traits(isRef, el))
{ {