#pragma once /* For now, the easiest way to use the token 'size_type' as a type. This however is NOT a new type. */ #define size_type unsigned int #include class vector { public: typedef char& reference; private: //is the information container char* InnerArray; //The size of the allocated memory size_type m_size; //Ctr on the elements that are in the vector size_type m_filled_in; //Max size of vector static const size_type m_max_size = 1000000; //size of increment when the vector is too //small for insertion static const size_type m_inc_size = 10; private:// helper functions void destroy(); void allocate( size_type ); public: ///Constructor, note the special notation for initialisation vector(size_type initialSize=0); vector(const vector&); ~vector(); bool empty() const{ //Note the const. In this case //it indicates that the method will not //modify the internal state of the object return capacity( )==0; }; size_type size() const{ //Returns the number of elements that are in //the vector. return this->m_filled_in; }; size_type capacity() const{ //Returns the size of the vector. return m_size; }; size_type max_size() const{ //Returns the largest possible size of the vector. return m_max_size; }; void push_back(const char&); void resize(int, char =(char)0); void dump() const{ printf("\nm_filled_in=%d, capacity( )=%d\n", m_filled_in, capacity( )); for(int i=0; i