public:
Destructor deletes just the node, not the private_data pointer
as the data element could be on more than one list. Takes O(1) time.
~Node();
Getters for traversing the list. Each method takes O(1) time.
Node<X>* get_next();
Node<X>* get_previous();
List<X>* get_owner();
Getters and setters for the private_data pointer.
Each method takes O(1) time.
X* get_data();
void set_data(X* x);
Const versions of the above methods. Each method takes O(1) time.
const Node<X>* get_next_const() const;
const Node<X>* get_previous_const() const;
const List<X>* get_owner_const() const;
const X* get_data_const() const;
Methods for adding to the list. Each method takes O(1) time.
void add_before_current(X* x);
void add_after_current(X* x);
Eliminates get_data() in client code. Each method takes O(1) time.
void add_before_current(Node<X>* n);
void add_after_current(Node<X>* n);
|