header

A List Class Implemented as a Dynamic Linked List

//---------------------------------------------------------
// list.cpp
//
// File for a list class based on a linked list.
//
// D. Searls
// REPLACE THIS LINE WITH YOUR NAME!!
// Asbury University
//---------------------------------------------------------

#ifndef H_LISTCLASS
#define H_LISTCLASS
 
#include<cstdlib>
using namespace std;

template<class itemType>
class list
{  
private:

    struct node
    {
        itemType info;
        node*    next;
    };
    
    int n;          // The number of elements in the list.
    node* head;     // A pointer to the first node in the list.
    node* current;  // A pointer to the current node. This is
                       used to point to the current node
                       following the invocation of the first()
                       or next() member functions.
  
public:

    //-----------------------------------------------------
    // Default Constructor
    //
    // Constructs an empty list.
    //-----------------------------------------------------
    list()
    {
    }
    
    //-----------------------------------------------------
    // Destructor
    //
    // Remove all of the items from the list
    //-----------------------------------------------------
    ~list()
    {
    }
    
    //-----------------------------------------------------
    // Copy Constructor
    //
    // Construct a list populated with the same values as
    // are in the specified list (but not necessarily in
    // the same order).
    //
    // In Parameter: theList
    //-----------------------------------------------------
    list(const list& theList)
    {
    }
    
    //-----------------------------------------------------
    // push_front
    //
    // Insert the specified item at the front of the list.
    //
    // In Parameter: item
    //-----------------------------------------------------
    void push_front(const itemType& item)
    {
    }
    
    //-----------------------------------------------------
    // pop_front
    //
    // Remove the first item of the list.
    //-----------------------------------------------------
    void pop_front()
    {
    }
    
    //-----------------------------------------------------
    // clear
    //
    // Remove all of the items from the list.
    //-----------------------------------------------------
    void clear()
    {
    }
   
    //-----------------------------------------------------
    // size
    //
    // Return the number of items in the list.
    //-----------------------------------------------------
    int size()
    {
    }
        
    //-----------------------------------------------------
    // first
    //
    // Return a pointer to the first item in the list (or
    // end() if the list is empty).
    //
    // The functions first(), next(), and end() are meant
    // to be used to perform a linear traversal of the list.
    //-----------------------------------------------------
    itemType* first()
    {        
    }
    
    //-----------------------------------------------------
    // next
    //
    // Return a pointer to the next item in the list (or
    // end() if there is no next item).
    //
    // The functions first(), next(), and end() are meant
    // to be used to perform a linear traversal of the list.
    //-----------------------------------------------------
    itemType* next()
    {
    }
    
    //-----------------------------------------------------
    // end
    //
    // Return the pointer just past the last element in
    // the list.
    //
    // The functions first(), next(), and end() are meant
    // to be used to perform a linear traversal of the list.
    //-----------------------------------------------------
    itemType* end()
    {
    }
};

#endif