diff --git a/std/base64.d b/std/base64.d index 2f7213b73..0fc92ac2b 100644 --- a/std/base64.d +++ b/std/base64.d @@ -639,7 +639,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') */ void popFront() { - enforce(!empty, new Base64Exception("Cannot call popFront on Encoder with no data remaining")); + assert(!empty, "Cannot call popFront on Encoder with no data remaining"); range_.popFront(); @@ -757,7 +757,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') */ void popFront() { - enforce(!empty, new Base64Exception("Cannot call popFront on Encoder with no data remaining")); + assert(!empty, "Cannot call popFront on Encoder with no data remaining"); static if (Padding != NoPadding) if (padding) @@ -1414,7 +1414,7 @@ template Base64Impl(char Map62th, char Map63th, char Padding = '=') */ void popFront() { - enforce(!empty, new Base64Exception("Cannot call popFront on Decoder with no data remaining.")); + assert(!empty, "Cannot call popFront on Decoder with no data remaining."); range_.popFront(); diff --git a/std/container/array.d b/std/container/array.d index ecc459969..13a0a787a 100644 --- a/std/container/array.d +++ b/std/container/array.d @@ -991,7 +991,7 @@ if (!is(immutable T == immutable bool)) */ void removeBack() { - enforce(!empty); + assert(!empty); static if (hasElaborateDestructor!T) .destroy(_data._payload[$ - 1]); @@ -1812,49 +1812,49 @@ if (is(immutable T == immutable bool)) /// Ditto @property T front() { - enforce(!empty, "Attempting to access the front of an empty Array"); + assert(!empty, "Attempting to access the front of an empty Array"); return _outer[_a]; } /// Ditto @property void front(bool value) { - enforce(!empty, "Attempting to set the front of an empty Array"); + assert(!empty, "Attempting to set the front of an empty Array"); _outer[_a] = value; } /// Ditto T moveFront() { - enforce(!empty, "Attempting to move the front of an empty Array"); + assert(!empty, "Attempting to move the front of an empty Array"); return _outer.moveAt(_a); } /// Ditto void popFront() { - enforce(!empty, "Attempting to popFront an empty Array"); + assert(!empty, "Attempting to popFront an empty Array"); ++_a; } /// Ditto @property T back() { - enforce(!empty, "Attempting to access the back of an empty Array"); + assert(!empty, "Attempting to access the back of an empty Array"); return _outer[_b - 1]; } /// Ditto @property void back(bool value) { - enforce(!empty, "Attempting to set the back of an empty Array"); + assert(!empty, "Attempting to set the back of an empty Array"); _outer[_b - 1] = value; } /// Ditto T moveBack() { - enforce(!empty, "Attempting to move the back of an empty Array"); + assert(!empty, "Attempting to move the back of an empty Array"); return _outer.moveAt(_b - 1); } /// Ditto void popBack() { - enforce(!empty, "Attempting to popBack an empty Array"); + assert(!empty, "Attempting to popBack an empty Array"); --_b; } /// Ditto @@ -2029,14 +2029,14 @@ if (is(immutable T == immutable bool)) */ @property bool front() { - enforce(!empty); + assert(!empty); return data.ptr[0] & 1; } /// Ditto @property void front(bool value) { - enforce(!empty); + assert(!empty); if (value) data.ptr[0] |= 1; else data.ptr[0] &= ~cast(size_t) 1; } @@ -2052,14 +2052,14 @@ if (is(immutable T == immutable bool)) */ @property bool back() { - enforce(!empty); + assert(!empty); return cast(bool)(data.back & (cast(size_t) 1 << ((_store._length - 1) % bitsPerWord))); } /// Ditto @property void back(bool value) { - enforce(!empty); + assert(!empty); if (value) { data.back |= (cast(size_t) 1 << ((_store._length - 1) % bitsPerWord)); diff --git a/std/container/binaryheap.d b/std/container/binaryheap.d index 723630c89..7ff14fc3b 100644 --- a/std/container/binaryheap.d +++ b/std/container/binaryheap.d @@ -249,7 +249,7 @@ according to `less`. */ @property ElementType!Store front() { - enforce(!empty, "Cannot call front on an empty heap."); + assert(!empty, "Cannot call front on an empty heap."); return _store.front; } @@ -317,7 +317,7 @@ Removes the largest element from the heap. */ void removeFront() { - enforce(!empty, "Cannot call removeFront on an empty heap."); + assert(!empty, "Cannot call removeFront on an empty heap."); if (_length > 1) { auto t1 = _store[].moveFront();