|
/// Access the ith element. Can throw RangeError. |
|
ref inout(E) opIndex(long i) scope return inout { |
|
if(i < 0 || i >= length) |
|
mixin(throwBoundsException); |
|
return _elements[i.toSizeT]; |
|
} |
struct Vector(E, Allocator = typeof(theAllocator)) if(isAllocator!Allocator) {
...
E[] _elements;
...
/// Access the ith element. Can throw RangeError.
ref inout(E) opIndex(long i) scope return inout {
if(i < 0 || i >= length)
mixin(throwBoundsException);
return _elements[i.toSizeT];
}
...
The signature is incorrect. Because this is passed by ref and the function returns by ref, the function is return-ref so it may return the address of this (this._elements), but not the value (this._elements[i]).
Blocking dlang/dmd#12665 (comment)
automem/source/automem/vector.d
Lines 208 to 213 in 8f61747
The signature is incorrect. Because
thisis passed byrefand the function returns byref, the function isreturn-refso it may return the address ofthis(this._elements), but not the value (this._elements[i]).Blocking dlang/dmd#12665 (comment)