The vector class you created is useful for storing objects in an array without having to worry about dynamic array allocation, but it can waste memory on unused elements of the array. One solution to this problem is a linked list.
The file list_test.cc contains a program that allows the user
to test adding ints to a linked list. For this assignment, write the
List
class. The class should be a template class that
implements a doubly linked list. The class should define four functions:
AddLast
function, that adds the specified object to the
end of a linked list.ostream
. When printing the list the first
element should be preceeded by a [ character and the last followed by a ]
character. Elements in the list should be separated with a comma followed
by a space. Note, the last object in the list should not be followed by
a comma and a space. You can assume that objects in the list have
overloaded the << operator.Be sure to test your code on multiple examples and on the cs server.
Tar your code in a file that contains your name and submit it on course Inquire site.