For our third homework we’ll be implementing the Stack ADT. The Stack ADT header is set up for the Node-
based implementation of the Stack presented in the text. You must complete the Node-based implementation
for the Stack.
A couple of points to note:
1. You must follow the rule of three for the Stack ADT implementation and use the copy-swap idiom.
2. The peek methods should throw a std::range_error exception when peeking at an empty stack.
3. I changed the Node implementation to return a const reference to the item instead of a copy of the
item. This shouldn’t cause problems in the future (and will result in fewer warnings for your Stack
As always, you need to write unit tests for your class.
1 The Stack Class
The outline of the class is deﬁned in the starter code inside the ﬁle Stack.hpp and documented in refman.pdf.
You are not allowed to modify the header ﬁle. You will need to deﬁne the methods and implement all methods
in the Stack.txx ﬁle. You should add appropriate comment blocks to each method, as well, in Stack.txx.
You will need to write tests in the student_tests.cpp using the Catch testing framework, as described in
class. The included CMakeLists.txt ﬁle sets up everything for you. Just generate your build directory for
your development environment as described in the course work-ﬂow tutorial.
We will be using an automatic grader to help you determine your assignment’s completeness and correctness.
A portion of each assignment grade will be determined by the number of passing tests as determined by the
autograder, with our evaluation ﬁlling in the rest. Thismeans you know before you turn in your submission that
all is well. You can submit to the autograder as many times as you like, but it is rate limited (ﬁve submissions
every hour) to keep you from using it as your compiler. See this canvas for a summary of how to use the grader
(Note is is not WebCAT, which many of you may be familiar with).
For this assignment you should upload a zip ﬁle containing only the ﬁles: Stack.txx and student_tests.cpp.
There is a build target called “submission” conﬁgured by default to create this ﬁle with the correct contents
in your build directory.