Store item in List rather than pointer to item

This commit is contained in:
josh committed 2023-10-25 21:28:27 -04:00
1 parent f5c6a35cef
commit 6251fee3ff
3 files changed
+5 -5

No files matched your search

+3 -3
View File
@@ -13,7 +13,7 @@ struct List(T)
/**
* Linked list item.
*/
T * item;
T item;
/**
* Next list entry.
@@ -23,7 +23,7 @@ struct List(T)
/**
* Add an item to this linked list.
*/
public void add(T * item)
public void add(T item)
{
List!T * last_entry = last_entry();
List!T * new_entry = A1.allocate!(List!T)();
@@ -34,7 +34,7 @@ struct List(T)
/**
* Allow foreach iteration across a List.
*/
public int opApply(scope int delegate(T *) dg)
public int opApply(scope int delegate(ref T) dg)
{
List!T * entry = &this;
while (entry.next != null)