#ifndef LIST_H_ #define LIST_H_ #include #include "Node.h" class List{ public: // default constructor: // POST: *this is an empty list List(); // destructor ~List(); // copy constructor List (const List& l); // assignment operator List& operator= (const List& l); // POST: key was added before first element of *this void push_front(int key); // POST: key was added after last element of *this void push_back (int key); // POST: the first occurrence of key was removed from *this // if *this does not contain key, nothing happened void remove (int key); // POST: returns const pointer to the first node const Node* get_head() const; // POST: the list was emptied void clear(); // POST: returns the number of the elements in *this int size() const; // POST: all duplicates in *this are removed void unique(); // POST: the elements of *this are in reversed order void reverse(); // POST: a copy of l is appended to *this void append(const List& l); // POST: *l is appended to *this - aliasing void append(const List* l); // on sheet (copy) private: Node* head_; // PRE: *this is empty // POST: list starting at from was copied to *this void copy (const Node* from); }; // output operator std::ostream& operator<< (std::ostream& o, const List& l); #endif