Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,21 @@
|
|||
struct SLinkedNode(T) {
|
||||
T data;
|
||||
typeof(this)* next;
|
||||
}
|
||||
|
||||
void insertAfter(T)(SLinkedNode!T* listNode, SLinkedNode!T* newNode) {
|
||||
newNode.next = listNode.next;
|
||||
listNode.next = newNode;
|
||||
}
|
||||
|
||||
void main() {
|
||||
alias N = SLinkedNode!char;
|
||||
|
||||
auto lh = new N('A', new N('B'));
|
||||
auto c = new N('C');
|
||||
|
||||
// Inserts C after A, creating the (A C B) list:
|
||||
insertAfter(lh, c);
|
||||
|
||||
// The GC will collect the memory.
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue