Foundation Class Collections Limited to 32K Total ObjectsID: Q85515
|
Each object of the "collection" classes provided by the Microsoft
Foundation Classes can store no more than 32,767 objects.
Collection classes include the following:
Arrays Lists Maps
----------------------------------------------------
CByteArray CObList CMapPtrToWord
CDWordArray CPtrList CMapPtrToPtr
CObArray CStringList CMapStringToOb
CPtrArray CMapStringToOb
CStringArray CMapStringToString
CWordArray CMapWordToOb
CMapWordToPtr
Each of the Microsoft Foundation Classes collection classes uses a
signed integers to store the total number of objects in an object of
the class. In MS-DOS and 16-bit Windows, a signed integer is limited
to 32K. In Windows NT, a 32-bit signed integer can index up to 2
billion items.
If you need to store more than 32K objects in a collection object, you
can create a collection class that does not use an "int" to index the
array.
The TEMPLDEF sample program includes a sample "list" implementation,
which may be modified to implement a collection of more than 32K
objects. Changing the type of the list's index variable from an "int"
to a "long" allows an application to create a list that contains up to
2,048,000 objects.
To implement the modified "list" class, perform the following
steps:
int GetCount() const
to the following:
long GetCount() const
and change
_AFXCOLL_INLINE int CLongList<TYPE, ARG_TYPE, IS_SERIAL,
HAS_CREATE>::GetCount() const
to the following:
_AFXCOLL_INLINE long CLongList<TYPE, ARG_TYPE, IS_SERIAL,
HAS_CREATE>::GetCount() const
POSITION FindIndex(int nIndex) const;
to the following:
POSITION FindIndex(long nIndex) const;
int m_nCount;
to the following:
long m_nCount;
POSITION CLongList<TYPE, ARG_TYPE, IS_SERIAL,
HAS_CREATE>::FindIndex(int nIndex) const
to the following:
POSITION CLongList<TYPE, ARG_TYPE, IS_SERIAL,
HAS_CREATE>::FindIndex(long nIndex) const
templdef "CLongList<CObject*,CObject*,0,0> CObLongList"
llist.ctt llist_o.h llist_o.inl llist_o.cpp
Make sure that LLIST_O.H is included in LLIST_O.CPP.
// Inline function declarations
#ifdef _AFX_ENABLE_INLINES
#include "llist_o.inl"
#endif //_AFX_ENABLE_INLINES
// Inlines
#ifndef _AFX_ENABLE_INLINES
#define _AFXCOLL_INLINE
#include "llist_o.inl"
#endif //!_AFX_ENABLE_INLINES
Additional query words: kbinf 7.00 1.00 1.50 2.00 2.50 2.51 2.52
Keywords : kb16bitonly
Version :
Platform :
Issue type :
Last Reviewed: August 3, 1999