Singly-Linked List Class - sllist Summary Template class sllist provides dynamic storage for any type of elements. State T *ptr pointer to the stored element sllist *next pointer to the next node in the list Methods sllist() Set pointers to NULL. unsigned int size() Return the number of items in the list. T* head() Return a pointer to the first element, or NULL if the list is empty. T* get(int target) Return the item indexed from first of list by target. Note: step() is faster for retrieving each item sequentially. T* step(int stride=1) Return the item indexed from previous step call by stride. Note: step contains a static variable, so don't "mix" step calls! Use step(0) to rewind. int count(T *key) Return the number of instances of key in the list. int push(T *newptr) Push a new node with a pointer to newptr onto the list. Return the number of items in the list. int insert(T *afterme, T *newptr) Insert a new node with a pointer to newptr into the list after the first node which points to afterme, if there is one. Return the number of items in the list. T* pop() Pop the top node off the list. Return a pointer to the top node, or NULL if the list is empty. int remove(T *bad, int deletes=-1) Remove nodes pointing to bad element. If deletes is non-negative, then it specifies the maximum number of nodes to be deleted. Otherwise all nodes matching bad are deleted. Return the number of nodes deleted.