/*Transcriber's note: these first two lines of ifndef and define are added to make compilation work.*/ #ifndef _H_IVECTOR #define _H_IVECTOR #include class IVector { public: // Constructor IVector(int initSize=0) : theSize{initSize}, theCapacity{initSize+10} { objects = new int(theCapacity); } // Destructor ~IVector() {delete [] objects;} // Check for emptyness bool empty() const {return size() == 0;} // Return size of list int size() const {return theSize;} // Access the element at a given index // This is the non-const version, so you can change the element. int& operator[](int index) { return objects[index]; } // Access the element at a given index // This is the const version, for accessing the value only const int& operator[](int index) const { return objects[index]; } // Increase the capacity (i.e., array size) void reserve(int newCapacity) { if(newCapacity>theSize){ int *newArray = new int[newCapacity]; for (int k=0;k