Function LinkedList.LinkedListNode.addNode

addNode -- insert a node into a list

void addNode (
  scope ref LinkedList.LinkedListHead list,
  scope LinkedList.LinkedListNode* prevNode = null
);

Insert a node into a doubly linked list AFTER a given node position. Insertion at the head of a list is possible by passing a zero value for node, though the addNodeHead function is slightly faster for that special case. Passing the tailNode of the list adds the node to the end of the list. Again addNodeTail() might be faster.

this - the node to insert AFTER...

Parameters

NameDescription
list a pointer to the target list header
prevNode the node after which to insert, or null to add to list head

Returns

Your list is larger by one node.

Example

ListHead myList;

ListNode* myNode, listNode; ... myNode.addNodeHead( myList, listNode );

Notes

This function does not arbitrate for access to the list. The calling thread must be the owner of the involved list.

Bugs

none

See

initListHead(), addNode(), remNode(), addNodeHead(), remNodeHead(), addNodeTail(), remNodeTail(), addNodeSorted(), findNode()