描述:
rt
解决方案1:
stl 个人感觉比MFC提供的要好
解决方案2: ATL 提供了许多存储和访问数据的类。在确定使用哪个类时有几个因素起决定作用,其中包括:
要存储的数据量
访问数据时的效率/性能比
按索引或按键访问数据的能力
数据的排序方式
个人喜好
小集合类
ATL 提供了下列处理少量对象的数组类。不过,这些类受到限制,仅供 ATL 在内部使用。建议您在程序中不要使用它们。
类 数据存储的类型
CSimpleArray 实现处理少量对象的数组类。
CSimpleMap 实现处理少量对象的映射类。
通用用途集合类
下面的类实现数组、列表和映射,并且以通用用途集合类的形式提供:
类 数据存储的类型
CAtlArray 实现数组。
CAtlList 实现列表。
CAtlMap 实现映射结构,通过该结构可以按键或按值引用数据。
CRBMap 使用“红/黑”算法来实现映射结构。
CRBMultiMap 实现“红/黑”多映射结构。
template<
typename E,
class ETraits = CElementTraits< E >
>
class CAtlArray
Parameters
E
The type of data to be stored in the array.
ETraits
The code used to copy or move elements.
Remarks
CAtlArray provides methods for creating and managing an array of elements of a user-defined type. Although similar to standard C arrays, the CAtlArray object can dynamically shrink and grow as necessary. The array index always starts at position 0, and the upper bound can be fixed, or allowed to expand as new elements are added.
For arrays with a small number of elements, the ATL class CSimpleArray can be used.
CAtlArray is closely related to MFC's CArray class and will work in an MFC project, albeit without serialization support.
template<
typename E,
class ETraits = CElementTraits< E >
>
class CAtlList
Parameters
E
The element type.
ETraits
The code used to copy or move elements. See CElementTraits Class for more details.
Remarks
The CAtlList class supports ordered lists of nonunique objects accessible sequentially or by value. CAtlList lists behave like doubly linked lists. Each list has a head and a tail, and new elements (or lists in some cases) can be added to either end of the list, or inserted before or after specific elements.
Most of the CAtlList methods make use of a position value. This value is used by the methods to reference the actual memory location where the elements are stored, and should not be calculated or predicted directly. If it is necessary to access the nth element in the list, the method CAtlList::FindIndex will return the corresponding position value for a given index. The methods CAtlList::GetNext and CAtlList::GetPrev can be used to iterate through the objects in the list.
This class provides methods for creating and managing a map object.
template<
typename K,
typename V,
class KTraits = CElementTraits< K >,
class VTraits = CElementTraits< V >
>
class CAtlMap
Parameters
K
The key element type.
V
The value element type.
KTraits
The code used to copy or move key elements. See CElementTraits Class for more details.
VTraits
The code used to copy or move value elements.
Remarks
CAtlMap provides support for a mapping array of any given type, managing an unordered array of key elements and their associated values. Elements (consisting of a key and a value) are stored using a hashing algorithm, allowing a large amount of data to be efficiently stored and retrieved.
The KTraits and VTraits parameters are traits classes that contain any supplemental code needed to copy or move elements.
An alternative to CAtlMap is offered by the CRBMap class. CRBMap also stores key/value pairs, but exhibits different performance characteristics. The time taken to insert an item, look up a key, or delete a key from a CRBMap object is of order log(n), where n is the number of elements. For CAtlMap, all of these operations typically take a constant time, although worst-case scenarios might be of order n. Therefore, in a typical case, CAtlMap is faster.
The other difference between CRBMap and CAtlMap becomes apparent when iterating through the stored elements. In a CRBMap, the elements are visited in a sorted order. In a CAtlMap, the elements are not ordered, and no order can be inferred.
,对,用stl的.
有vector,list,map 等东西给你用.
同意 tlg2003(tlg2003) ,stl一样也可用!
解决方案6:C++的STL。
解决方案7:stl库有
解决方案8: 界面可以用wtl
数据结构使用stl
抛开