Export (0) Print
Expand All
2 out of 8 rated this helpful - Rate this topic

CList Class 

Supports ordered lists of nonunique objects accessible sequentially or by value.


template< class TYPE, class ARG_TYPE = const TYPE& > 
class CList : public CObject

Parameters

TYPE

Type of object stored in the list.

ARG _ TYPE

Type used to reference objects stored in the list. Can be a reference.

CList lists behave like doubly-linked lists.

A variable of type POSITION is a key for the list. You can use a POSITION variable as an iterator to traverse a list sequentially and as a bookmark to hold a place. A position is not the same as an index, however.

Element insertion is very fast at the list head, at the tail, and at a known POSITION. A sequential search is necessary to look up an element by value or index. This search can be slow if the list is long.

If you need a dump of individual elements in the list, you must set the depth of the dump context to 1 or greater.

Certain member functions of this class call global helper functions that must be customized for most uses of the CList class. See Collection Class Helpers in the "Macros and Globals" section.

For more information on using CList, see the article Collections.

// CList is a template class that takes two template arguments.
// The first argument is type stored internally by the list, the
// second argument is the type used in the arguments for the
// CList methods.

// This code defines a list of ints.
CList<int,int> myList;

// This code defines a list of CStrings
CList<CString,CString&> myList;

// This code defines a list of MYTYPEs,
//NOTE: MYTYPE could be any struct, class or type definition
CList<MYTYPE,MYTYPE&> myList;

Header: afxtempl.h

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.