CS 311 Fall 2020  >  Project 5

CS 311 Fall 2020
Project 5

Project 5 is due at 5 pm Thursday, October 29. It is worth 60 points.


This is, optionally, a group assignment. You may work in a group of 2 or 3, if you wish. Each group only needs to turn in a single copy of the assignment. Under normal circumstances, each group member will receive the same grade on the assignment.

Turn in answers to the exercises below on the UA Blackboard Learn site, under Project 5 for this class.

If you work in a group:

Exercises (60 pts total)

Exercise A — Templated Frightfully Smart Array Class


In this exercise, you will write a class template that acts as a “smart array”. It will not be quite as fancy as std::vector, but it will be significantly better than MSArray, from Project 2; in particular, the array will be resizable and exception-safe, as well as efficient.

Key to this project is exception safety. Make sure that exceptions thrown by value-type operations are properly handled, and that all safety guarantees are documented.

And as always, make your code high quality.


This project may be done individually or in a group of 2 or 3.

Implement a C++ class template that manages and allows access to a resizable array. The type of item in the array should be specified by the client code. Be sure to follow the coding standards. All standards now apply!

Other than the class name and the fact that it is a class template with a client-specified value type, the interface for TFSArray should be that covered in recent class meetings. This interface is as follows.

In addition:

Test Program

A test program is available: tfsarray_test.cpp. If you compile and run the test program (unmodified!) with your code, then it will test whether your code works properly.

The test program requires doctest.h, the header for the doctest unit-testing framework, version 2.

Do not turn in the test program or the doctest framework.