CObList::CObList
Visual Studio 2010
Constructs an empty CObject pointer list.
CObList( INT_PTR nBlockSize = 10 );
As the list grows, memory is allocated in units of nBlockSize entries. If a memory allocation fails, a CMemoryException is thrown.
The following table shows other member functions that are similar to CObList::CObList.
|
Class |
Member Function |
|---|---|
|
CPtrList( INT_PTR nBlockSize = 10 ); |
|
|
CStringList( INT_PTR nBlockSize = 10 ); |
Below is a listing of the CObject-derived class CAge used in all the collection examples:
// Simple CObject-derived class for CObList and other examples class CAge : public CObject { DECLARE_SERIAL( CAge ) private: int m_years; public: CAge() { m_years = 0; } CAge(int age) { m_years = age; } CAge(const CAge& a) { m_years = a.m_years; } // Copy constructor void Serialize(CArchive& ar); void AssertValid() const; const CAge& operator=(const CAge& a) { m_years = a.m_years; return *this; } BOOL operator==(CAge a) { return m_years == a.m_years; } #ifdef _DEBUG void Dump(CDumpContext& dc) const { CObject::Dump(dc); dc << m_years; } #endif };
Below is an example of CObList constructor usage: