Fix list assertions for release build

This commit is contained in:
Eugen Wissner 2018-04-18 14:23:12 +02:00
parent 40c961867e
commit 964a7af32f

View File

@ -435,9 +435,9 @@ struct SList(T)
assert(l2.front == 9); assert(l2.front == 9);
} }
version (assert)
{
private bool checkRangeBelonging(ref const Range r) const private bool checkRangeBelonging(ref const Range r) const
{
version (assert)
{ {
const(Entry)* pos = this.head; const(Entry)* pos = this.head;
for (; pos !is *r.head && pos !is null; pos = pos.next) for (; pos !is *r.head && pos !is null; pos = pos.next)
@ -445,6 +445,10 @@ struct SList(T)
} }
return pos is *r.head; return pos is *r.head;
} }
else
{
return true;
}
} }
/** /**
@ -1602,9 +1606,9 @@ struct DList(T)
/// ditto /// ditto
alias insert = insertBack; alias insert = insertBack;
version (assert)
{
private bool checkRangeBelonging(ref const Range r) const private bool checkRangeBelonging(ref const Range r) const
{
version (assert)
{ {
const(Entry)* pos = this.head; const(Entry)* pos = this.head;
for (; pos !is *r.head && pos !is null; pos = pos.next) for (; pos !is *r.head && pos !is null; pos = pos.next)
@ -1612,6 +1616,10 @@ struct DList(T)
} }
return pos is *r.head; return pos is *r.head;
} }
else
{
return true;
}
} }
/** /**