#ifndef VECTOR_H #define VECTOR_H #include /** * This class provides a Vector, as defined in Chapter 5.1 of the * Goodrich, Tamassia, Mount textbook. It is actually a wrapper, * relying on the STL vectors for the implementation. */ #include #include "BoundaryViolationException.h" template class Vector { public: int size() const; bool isEmpty() const; const Object& elemAtRank(int r) const throw(BoundaryViolationException); void replaceAtRank(int r, const Object& e) throw(BoundaryViolationException); void removeAtRank(int r) throw(BoundaryViolationException); void insertAtRank(int r, const Object& e) throw(BoundaryViolationException); private: vector V; // we are relying on STL vectors void checkRank(int rank) const throw(BoundaryViolationException); }; /* * display vector (assuming that out << Object is well defined!) */ template std::ostream& operator<<(std::ostream& out, const Vector& V); #include "Vector.tcc" #endif