Question: We discussed that the C++ Standard Library specifies a small collection of exception guarantees, and that some guarantees are stronger than others. Suppose you were

We discussed that the C++ Standard Library specifies a small collection of exception guarantees, and that some guarantees are stronger than others. Suppose you were implementing anArrayListclass template, similar to the one we implemented in lecture, but one that was more full-featured than ours now that we know more C++, we can design better types. While implementing it, you would need to consider the exception safety guarantees of each of its member functions.

  1. Give an example of a member function (outside of the Big Three) that you might write in your class template where the nothrow guarantee would be inappropriate, but the strong guarantee would be appropriate. Why would the nothrow guarantee be an inappropriate choice in your example?
  2. Give an example of a member function (outside of the Big Three) that you might write in your class template where the strong guarantee would be inappropriate, but the basic guarantee would be appropriate. Why would the strong guarantee be an inappropriate choice in your example?

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 Programming Questions!