template <typename Object> class List { // List interface public: class Position; // node position type // query functions int size() const; bool isEmpty() const; bool isFirst(const Position& p) const throw(InvalidPositionException); bool isLast(const Position& p) const throw(InvalidPositionException); // accessor functions Position first() const throw(EmptyContainerException); Position last() const throw(EmptyContainerException); Position before(const Position& p) const throw(InvalidPositionException, BoundaryViolationException); Position after(const Position& p) const throw(InvalidPositionException, BoundaryViolationException); // update functions Position insertBefore(const Position& p, const Object& element) throw(InvalidPositionException); Position insertAfter(const Position& p, const Object& element) throw(InvalidPositionException); Position insertFirst(const Object& element); Position insertLast(const Object& element); void remove(const Position& p) throw(InvalidPositionException); void replaceElement(const Position& p, const Object& element) throw(InvalidPositionException); void swapElements(const Position& a, const Position& b) throw(InvalidPositionException); };