Fix a few places where opDollar could be an alias of length

This commit is contained in:
Nathan Sashihara 2020-11-10 10:13:51 -08:00 committed by The Dlang Bot
parent 25348d61dd
commit fe1deb2f84
4 changed files with 4 additions and 7 deletions

View file

@ -3858,7 +3858,7 @@ if (canSwapEndianness!T && isInputRange!R && is(ElementType!R : const ubyte))
return UbyteRange(impl[start .. end]);
}
@property size_t length() { return impl.length; }
size_t opDollar() { return impl.length; }
alias opDollar = length;
}
static assert(hasSlicing!UbyteRange);

View file

@ -1785,10 +1785,7 @@ if (is(immutable T == immutable bool))
{
return _store.refCountedStore.isInitialized ? _store._length : 0;
}
size_t opDollar() const
{
return length;
}
alias opDollar = length;
/**
* Returns: The maximum number of elements the array can store without

View file

@ -4198,7 +4198,7 @@ private:
@property bool empty() { return array.length == 0; }
@property C front() { return array[0]; }
@property C back() { return array[$ - 1]; }
@property size_t opDollar() { return length; }
alias opDollar = length;
C opIndex(size_t i) { return array[i]; }
}
void popFront() { array = array[1 .. $]; }

View file

@ -1473,7 +1473,7 @@ private struct SliceOverIndexed(T)
@property size_t length()const { return to-from;}
auto opDollar()const { return length; }
alias opDollar = length;
@property bool empty()const { return from == to; }