array manipultaion via unios

Started by
9 comments, last by xe_sphinx 22 years, 5 months ago
You probably want to use the STL vector, but for future reference:

  template<typename T>class CArray	{	CArray(int iSize) : m_iSize(iSize)		{		m_pData = new T[m_iSize];		};	~CArray()		{		delete[] m_pData;		}	T& operator[](int i)		{		_ASSERT(i>=0 && i<m_iSize);		return m_pData[i];		}	const int m_iSize;	T* m_pData;	};  

If you want the size to be constant, do that. If it''s not constant, don''t fudge it with a union.

Magmai Kai Holmlor
- Not For Rent
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement