View Single Post
Old 07-10-2004, 06:55 PM   #3 (permalink)
joe_bruin
LOAD "*",8,1
 
Join Date: Feb 2003
Location: la.ca.us
Posts: 254
joe_bruin is on a distinguished road
improvements inline:

Code:
	void ResizeOne()
	{
		T* temp = new T[m_intSize+1];
		if(temp == NULL)
		{
			// unhandled memory allocation failure
		}
		for(int i = 0; i < m_intSize; ++i)
			temp[i] = internalData[i];
		delete[] internalData;
		/*
		// this is redundant
		internalData = new T[m_intSize+1];
		for(int i = 0; i < m_intSize; ++i)
			internalData[i] = temp[i];
		
		delete[] temp;
                */
		internalData = temp;
		m_intSize++;
	}
preallocating some extra space will make this
joe_bruin is offline   Reply With Quote