Question: compiler required: visual studio 2019 and do not use #include (cannot use another compiler. my professor only allows this compiler) Write a class template for

compiler required: visual studio 2019 and do not use #include (cannot use another compiler. my professor only allows this compiler)

Write a class template for a map with a fixed type for the keys string. and a template type parameter for the values. Use open hashing (chaining) with an array or vector of pointers to STL linked lists. Provide the following public member functions:

  • Constructor
  • Destructor
  • Copy constructor
  • Assignment operator
  • Operator ==
  • Function size that returns the number of key-value pairs in the map
  • Function count that returns the number of elements with a specific key
  • Function insert that inserts a key-value pair into the map
  • Function at that returns a reference to the mapped value of the element identified with a specific key k. If k does not match the key of any element in the map, the function should throw an out_of_range exception.
  • Function erase that removes a key-value pair identified with a specific key k. If k does not match the key of any element in the map, the function should throw an out_of_range exception.
  • Function key_comp that returns a key comparison object, a function object comparing keys and returning true if the first argument (key) for comparison is less than the second and false otherwise

Provide a test program to test your template with at least two different types of values. (have the main include Studio Ghibli Animated Film names)

Hint: First implement a class for values of some fixed data type, for example integer or string, and then convert it to a class template. It makes sense to submit both the non-template and the template versions.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!