c_list

Table Of Contents

Introduction, c_list

c_list is an implementation of the c_collection interface for a doubly linked list. This allows you to add elements to the top of the list, to the bottom of the list, and at any arbritrary point in the list. It also allows you to remove elements from either the head, the tail, or from an arbritrary point in the list.

This allows c_list to easily be used as a FILO [first in, last out] queue, or as a LIFO [last in, first out] queue. List objects can be traversed in either pre, or post order (forward, or backward) with much more effiencey than a stack object.

API Refrence

Example Code:
void use_a_list( c_list<c_string> list )
{
    c_string front("stick me on the front");
    c_string back("stick me on the back");

    list.add_head(front);
    list.add_tail(front);

    c_string elm;
    list.get_at(2, elm);
    if( elm == back ) {
      cout << "There were only two elements in the list!" << endl;
    }
    else {
      cout << "the second element is: " << elm << endl;
    }
}

Up