Thanks for the reply. I understand but one of the reasons I wanted to use Structs instead of Class for IntrusiveList was to avoid heap allocation. At the end I would get fragmented resources which would defeat the whole purpose of creating an intrusive list.
Monkey
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
' IntValue layed out in memory if IntrusiveList is a Struct
ClassIntValue
[
value:Int,
node_pPrev:IntrusiveList
node_pNext:IntrusiveList
node_pHead:IntrusiveList
node_pOwner:IntValue
]
' IntValue layed out in memory if IntrusiveList is a Class
ClassIntValue
[
value:Int
node:IntrusiveList->Some random place inmemory
]
IntrusiveList as a Class would be a very slow structure.