Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

COP 4 5 3 0 Project 3 : Doubly - Linked List Container - - STL Interface Module Assignment details Objectives: Understanding generic programming and

COP4530 Project 3: Doubly-Linked 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 doubly-linked 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 const_iterator). You cannot change anything in the List.h file. The List.h file is attached to this assignment.
A driver program test_list.cpp has been included. It is an example test program that will run some tests on your implementation of the doubly-linked 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 doubly-linked 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::const_iterator, and non-class 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 const_iterator class:
const iterator(): default zero-parameter constructor. Set pointer current to nullptr.
operator : returns a reference to the corresponding element in the list by calling retrieve() member function.
operator++(), operator++(int), operator--(), operator--(int): prefix and postfix increment and decrement operators.
operator==()and operator!=(): two iterators are equal if they refer to the same element.
retrieve(): return a reference to the corresponding element in the list.
const iterator(Node ?** p): one-parameter constructor. Set pointer current to the given node pointer p.
Note: The const_iterator class is designed to access individual nodes with changing them.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

2. What is the meaning and definition of Banking?

Answered: 1 week ago

Question

3.What are the Importance / Role of Bank in Business?

Answered: 1 week ago