/* * Node.h * * Created on: Feb 3, 2009 * Author: adrienne * Based on the code on pg. 255 of Koffman/Wolfgang text */ #ifndef NODE_H_ #define NODE_H_ struct Node { Element_Type data; //The data stored in this node Node* next; //Pointer to the next node in the list Node* prev; //Pointer to the previous node in the list /** * This is a constructor for the struct. It uses default values for the * data members and uses an initializer block syntax (nothing inside the {}). * * Usage (without pointers): * Node node(value); * Creates a node with the value specified and prev and next set to NULL * * Node node(value, prev); * Creates a node with the value specified and prev set, next is NULL * * Node node(value, prev, next); * Creates a node with the value specified and prev and next set. * */ Node(const Element_Type& the_data, Node* prev_val = NULL, Node* next_val = NULL) : data(the_data), next(next_val), prev(prev_val) {} }; #endif