Note: it is acceptable to use
unique_ptr instead of the shared_ptr for the bonus lab.
The objective of this lab is to get experience with the use of smart pointers
(shared_ptr, weak_ptr) in C++.
The exercise itself is fairly straightforward:
the repository contains an implementation of a binary search tree
(for key/value string pairs) in files tree.h, tree.cpp, bstree.h, and bstree.cpp
it also contains a program using the trees in files bonus.h and bonus.cpp
these files all currently use raw (dumb) C++ pointers
the objective is to convert them to make appropriate use of C++ smart pointers
(using shared_ptr, weak_ptr etc from the <memory> library)
The code comes from a prior CSCI 161 assignment, getting a bstree implemented and
trying it out. We care less about the behaviour here and more about the
correct/appropriate handling of memory through smart pointers.
Some sample code is available for 'smart' linked lists,
with a main routine that illustrates much of what is taking place.
Discussion of smart pointers (slides and video) can be found on the
lecture resources page. The concepts still hold,
but most of the syntax is from an antiquated implementation of the shared pointers.
The repo can be obtained and submitted in our usual git fashion, with 'bonus' as the repo name
(instead of labX).
It is due at 8pm Sunday Apr. 14, and unlike the regular labs
NO LATE SUBMISSIONS WILL BE ACCEPTED.
The bonus lab mark can be used to replace one lower lab mark.