CSE 241/505 Homework # 6 Inheritance, Templates, STL solved

$35.00 $21.00

Category: You will receive a download link of the .ZIP file upon Payment


5/5 - (1 vote)

In this homework, you will write a templated class hierarchy for a simple container class hierarchy.
The class GTUContainer is an abstract class with the following pure virtual member functions.
Test whether container is empty
Return container size
Return maximum size
Insert element, throws exception std::bad_pafram if there is a problem with insersion
Erase element
Clear all content
Return iterator to beginning
Return iterator to end
The class GTUSet derives from the base class and implements all of the functions appropriately
for a set class.
The class GTUVector derives from the base class and implements all of the functions
appropriately for a vector class. This class will also overload the [] operator. You may write other
helper classes to make your work easier.
All classes will keep their data using dynamic memory techniques with shared_ptr STL pointers. Do
not use regular pointers or STL container classes.
The classes GTUIterator and GTUIteratorConst implement iterator operators such as *, ->,
++, –, =, and ==.
You will also implement the following global functions from the STL library which will accept
GTUIterator parameters instead of regular STL iterators
 find
 find_if
 for_each
Write your driver program to test the all the classes and all of their functions. Do not forget to test the
global functions with all concrete classes.
• Use separate header and implementation files for each class.
• Use name spaces.
• Do not forget to test the thrown exceptions.