This course has already ended.

Exercise: Exception Safety

Get to know the following interface

class VectorInt
{
  public:
      VectorInt();
      ~VectorInt();

      int front() const;

      int& operator[](int location);
      int& at(int location);

      void push_back(int element);

      void swap(VectorInt& v);

      void insert(int location, int element);
      void insert(int location, VectorInt& values);

 private:
      int* datablock_; // This pointer will point to an array of integers allocated with new
      int blocksize_;  // Size of the allocated array
      int elementamount_;   // size of the area used from array
 };

Consider its exception situations: What kind of state an object has after an exception? What would be the exception guarantee of services?

A+ presents the exercise submission form here.

Posting submission...