EE221 Assignment 13
Program 1 (90pts.)
Consider the provided
simplified library for linked list class template
that was discussed in class. That library has a few of the class
methods left unimplemented or not fully developped. Implement or
enhance the features listed below by modifying the list library
file and test in a
provided test program.
Should you leave something unlimplemented - comment the corresponding portion of
the test program to avoid compiler or run-time errors.
Implement or enhance:
- improve iterator::operator++(int); - if the iterator points to the end location -- should now point to the first list element
- improve iterator::operator--(); - if the iterator points to the end location -- should now point to the last list element
- implement iterator::operator--(int); - implement the improved version (see above)
- implement list::pop_back();
- improve list::insert(iterator before, iter value); so that it works with end iterator too. (Hint: use push_back if called with end postion and return an iterator pointing to the last element.)
- block the assignment list::operator = so that it canot be used on the list. (Hint: declare as private and left unimplemented.)
- implement list::list(list & copy); the copy constructor. (Hint: go through the list X like the old function size() did and push_back(..) each value stored in the list X to append it the current list)
- implement list::insert(iterator before, iterator beg2, iterator end2); - implement by calling list::insert(iterator before, value) in a loop that goees through the data collection beg2..end2
- improve list::size(); - by adding a private integer variable that keeps track of the current number of elements stored in the list. (Hint: throw away the current code inside size() and return that integer.)
You must use the list<T> library provided on this page and do
the modifications to it to get any credit. Do not use the version provided on
the coruse examples list, or obtained from any other source. This version has a
hidden "watermark" that will be checked.