Answered step by step
Verified Expert Solution
Question
1 Approved Answer
COP 4 5 3 0 Project 3 : Doubly - Linked List Container - - STL Interface Module Assignment details Objectives: Understanding generic programming and
COP Project : DoublyLinked List Container STL Interface
Module Assignment details
Objectives: Understanding generic programming and information hiding by developing generic containers. Getting familiar with the concept of class template and its usage. Use of nested iterator classes. Use of namespace. Operator overloading.Task: Implement a doublylinked list class template List and its associated iterators.
Requirements:
A header file List.h is provided, which contains the interfaces of the doubly linked list class template List. In particular, it contains a nested Node structure, and two nested iterators class iterator and constiterator You cannot change anything in the List.h file. The List.h file is attached to this assignment.
A driver program testlist.cpp has been included. It is an example test program that will run some tests on your implementation of the doublylinked list class template for different data types. Don't make any changes to this driver program. However, your class will be tested with more than just this sample driver. It is recommended that you write other driver programs of your own, for more thorough testing.
You need to implement the member functions of the doublylinked list class template List in a file named List.hpp Note that List.hpp has been #included in the header file List.h towards the end of the file As we have discussed in lecture, you should not try to compile List.hpp or List.h by themselves. These comprise a header that will be #included into other programs you might write. You need to implement all the member functions of List, List::iterator, and List::constiterator, and nonclass overloaded functions operator operator! and operator included in List.h The design of the List container follows the one presented in the textbook. It has three member variables, theSize, head, and tail. theSize records the number of elements in the list. The head should point to the first node, the tail should point to a sentinel node one passed the last data node An empty list will only contain the sentinel node. Your implementation will contain more features than those in the textbook's implementation. We describe the requirements of each function in the following this specifications may not write the function signatures in detail, please refer to the List.h file for the detailed function declaration
Member functions of nested constiterator class:
const iterator: default zeroparameter constructor. Set pointer current to nullptr.
operator : returns a reference to the corresponding element in the list by calling retrieve member function.
operator operatorint operator operatorint: prefix and postfix increment and decrement operators.
operatorand operator!: two iterators are equal if they refer to the same element.
retrieve: return a reference to the corresponding element in the list.
const iteratorNode p: oneparameter constructor. Set pointer current to the given node pointer p
Note: The constiterator class is designed to access individual nodes with changing them.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started