#pragma once // Growable array stored as an array of fixed-size chunks (each chunk is a new T[]). template class CChunkedArray { public: ~CChunkedArray() { Reset(); } void Reset(); int m_length; int m_chunkSize; int m_alloc; int m_0c; T** m_chunks; int m_numChunks; int m_18; }; template void CChunkedArray::Reset() { for (int i = 0; i < m_numChunks; i++) { if (m_chunks[i]) delete[] m_chunks[i]; } delete[] m_chunks; m_chunks = 0; m_numChunks = 0; m_length = 0; } // Intrusive reference-counted pointer; T has an int refcount and owns its own operator delete. template class CRefPtr { public: ~CRefPtr() { if (m_p) { m_p->m_refCount--; if (m_p->m_refCount <= 0) delete m_p; } } T* m_p; };