Skip to content

Commit 2892cfc

Browse files
authored
Merge pull request #73 from putaolabs/master
interface should be same as class. and DynamicArray should be null too
2 parents 3938bd0 + 4228f4e commit 2892cfc

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ test/external_allocator_test_32
1717
__test__*__
1818
*.exe
1919
.directory
20+
*.userprefs
21+
.vscode

src/containers/dynamicarray.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct DynamicArray(T, Allocator = Mallocator, bool supportGC = shouldAddGCRange
5454
return;
5555
foreach (ref item; arr[0 .. l])
5656
{
57-
static if (is(T == class))
57+
static if (is(T == class) || is(T == interface))
5858
destroy(item);
5959
else
6060
typeid(T).destroy(&item);
@@ -164,7 +164,7 @@ struct DynamicArray(T, Allocator = Mallocator, bool supportGC = shouldAddGCRange
164164
{
165165
if (i < this.l)
166166
{
167-
static if (is(T == class))
167+
static if (is(T == class) || is(T == interface))
168168
destroy(arr[i]);
169169
else
170170
typeid(T).destroy(&arr[i]);

src/containers/internal/node.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ version (X86_64)
5353
template shouldNullSlot(T)
5454
{
5555
import std.traits;
56-
enum shouldNullSlot = isPointer!T || is (T == class);
56+
enum shouldNullSlot = isPointer!T || is (T == class) || is (T == interface) || isDynamicArray!T;
5757
}
5858

5959
template shouldAddGCRange(T)
6060
{
6161
import std.traits;
62-
enum shouldAddGCRange = isPointer!T || hasIndirections!T || is (T == class);
62+
enum shouldAddGCRange = hasIndirections!T;
6363
}
6464

6565
static assert (shouldAddGCRange!string);

src/containers/ttree.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ private:
532532
bool insert(T value, ref Node* root, AllocatorType allocator)
533533
in
534534
{
535-
static if (isPointer!T || is (T == class))
535+
static if (isPointer!T || is (T == class) || is (T == interface))
536536
assert (value !is null);
537537
}
538538
body
@@ -718,7 +718,7 @@ private:
718718
}
719719
out (result)
720720
{
721-
static if (isPointer!T || is (T == class))
721+
static if (isPointer!T || is (T == class) || is(T == interface))
722722
assert (result !is null);
723723
}
724724
body

src/containers/unrolledlist.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct UnrolledList(T, Allocator = Mallocator,
7272
{
7373
prev = cur;
7474
cur = cur.next;
75-
static if (!is(T == class))
75+
static if (!(is(T == class) || is(T == interface)))
7676
foreach (ref item; cur.items)
7777
typeid(T).destroy(&item);
7878
deallocateNode(prev);

0 commit comments

Comments
 (0)