From fe1deb2f842d391d9b82258167ee76c440f80fd4 Mon Sep 17 00:00:00 2001 From: Nathan Sashihara <21227491+n8sh@users.noreply.github.com> Date: Tue, 10 Nov 2020 10:13:51 -0800 Subject: [PATCH] Fix a few places where opDollar could be an alias of length --- std/bitmanip.d | 2 +- std/container/array.d | 5 +---- std/path.d | 2 +- std/uni/package.d | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) diff --git a/std/bitmanip.d b/std/bitmanip.d index 88c28065d..2b41c5aac 100644 --- a/std/bitmanip.d +++ b/std/bitmanip.d @@ -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); diff --git a/std/container/array.d b/std/container/array.d index 385e852ce..643caa929 100644 --- a/std/container/array.d +++ b/std/container/array.d @@ -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 diff --git a/std/path.d b/std/path.d index e203041f0..7dfc4ab34 100644 --- a/std/path.d +++ b/std/path.d @@ -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 .. $]; } diff --git a/std/uni/package.d b/std/uni/package.d index f7f1877f4..5816064df 100644 --- a/std/uni/package.d +++ b/std/uni/package.d @@ -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; }