vector.h

00001 
00010 template <typename T>
00011 class Vector {
00012 
00013   public:
00014     Vector();
00015     Vector( const unsigned, const T & = T() ) throw ( bad_alloc );
00016     Vector( const Vector<T> & ) throw ( bad_alloc );
00017     ~Vector();
00018     bool empty() const;
00019     unsigned size() const;
00020     unsigned capacity() const;
00021     void clear();
00022     void resize( const unsigned, const T & = T() ) throw ( bad_alloc );
00023     T &at( const unsigned ) const throw ( VectorEmpty, OutOfBounds );
00024     void assign( const unsigned, const T & ) throw ( VectorEmpty, OutOfBounds );
00025     void push_back( const T & ) throw ( bad_alloc );
00026     void insert( const unsigned, const T & ) throw ( bad_alloc, OutOfBounds );
00027     void remove( const unsigned ) throw ( VectorEmpty, OutOfBounds );
00028     T &operator[]( const unsigned ) const throw ( VectorEmpty, OutOfBounds );
00029     const Vector<T> &operator=( const Vector<T> & ) throw ( bad_alloc );
00030 
00031   private:
00032     T *contents;
00033     unsigned sz, cap;
00034 
00035     void increaseCapacity() throw ( bad_alloc );
00036 
00037 }; // Vector class
00038 
00039 /*------------------------------------------------------------------------*/
00040 
00045 template <typename T>
00046 Vector<T>::Vector()
00047 {
00048 } // Vector<T>::Vector
00049 
00050 /*------------------------------------------------------------------------*/
00051 
00059 template <typename T>
00060 Vector<T>::Vector( const unsigned sz, const T &v ) throw ( bad_alloc )
00061 {
00062 } // Vector<T>::Vector
00063 
00064 /*------------------------------------------------------------------------*/
00065 
00072 template <typename T>
00073 Vector<T>::Vector( const Vector<T> &v ) throw ( bad_alloc )
00074 {
00075 } // Vector<T>::Vector
00076 
00077 /*------------------------------------------------------------------------*/
00078 
00083 template <typename T>
00084 Vector<T>::~Vector()
00085 {
00086 } // Vector<T>::~Vector
00087 
00088 /*------------------------------------------------------------------------*/
00089 
00096 template <typename T>
00097 bool Vector<T>::empty() const
00098 {
00099 } // Vector<T>::empty
00100 
00101 /*------------------------------------------------------------------------*/
00102 
00109 template <typename T>
00110 unsigned Vector<T>::size() const
00111 {
00112 } // Vector<T>::size
00113 
00114 /*------------------------------------------------------------------------*/
00115 
00123 template <typename T>
00124 unsigned Vector<T>::capacity() const
00125 {
00126 } // Vector<T>::capacity
00127 
00128 /*------------------------------------------------------------------------*/
00129 
00134 template <typename T>
00135 void Vector<T>::clear()
00136 {
00137 } // Vector<T>::clear
00138 
00139 /*------------------------------------------------------------------------*/
00140 
00151 template <typename T>
00152 void Vector<T>::resize( const unsigned newSize, const T &v ) throw ( bad_alloc )
00153 {
00154 } // Vector<T>::resize
00155 
00156 /*------------------------------------------------------------------------*/
00157 
00164 template <typename T>
00165 void Vector<T>::increaseCapacity() throw ( bad_alloc )
00166 {
00167 } // Vector<T>::increaseCapacity
00168 
00169 /*------------------------------------------------------------------------*/
00170 
00181 template <typename T>
00182 T &Vector<T>::at( const unsigned i ) const throw ( VectorEmpty, OutOfBounds )
00183 {
00184 } // Vector<T>::at
00185 
00186 /*------------------------------------------------------------------------*/
00187 
00197 template <typename T>
00198 void Vector<T>::assign( const unsigned i, const T &object )
00199   throw (VectorEmpty, OutOfBounds)
00200 {
00201 } // Vector<T>::assign
00202 
00203 /*------------------------------------------------------------------------*/
00204 
00213 template <typename T>
00214 void Vector<T>::push_back( const T &object ) throw ( bad_alloc )
00215 {
00216 } // Vector<T>::push_back
00217 
00218 /*------------------------------------------------------------------------*/
00219 
00230 template <typename T>
00231 void Vector<T>::insert( const unsigned i, const T &object )
00232   throw ( bad_alloc, OutOfBounds )
00233 {
00234 } // Vector<T>::insert
00235 
00236 /*------------------------------------------------------------------------*/
00237 
00246 template <typename T>
00247 void Vector<T>::remove( const unsigned i ) throw (VectorEmpty, OutOfBounds)
00248 {
00249 } // Vector<T>::remove
00250 
00251 /*------------------------------------------------------------------------*/
00252 
00263 template <typename T>
00264 T &Vector<T>::operator[]( const unsigned i ) const
00265   throw ( VectorEmpty, OutOfBounds )
00266 {
00267 } // Vector<T>::operator[]
00268 
00269 /*------------------------------------------------------------------------*/
00270 
00279 template <typename T>
00280 const Vector<T> &Vector<T>::operator=( const Vector<T> &v ) throw ( bad_alloc )
00281 {
00282 } // Vector<T>::operator=
00283 
00284 #endif // VECTOR_H

Generated on Sun Mar 16 16:50:19 2008 by  doxygen 1.5.1