CAtlArray Class

This class implements an array object.

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.

Members

Methods

Add

Call this method to add an element to the array object.

Append

Call this method to add the contents of one array to the end of another.

AssertValid

Call this method to confirm that the array object is valid.

CAtlArray

The constructor.

~CAtlArray

The destructor.

Copy

Call this method to copy the elements of one array to another.

FreeExtra

Call this method to remove any empty elements from the array.

GetAt

Call this method to retrieve a single element from the array object.

GetCount

Call this method to return the number of elements stored in the array.

GetData

Call this method to return a pointer to the first element in the array.

InsertArrayAt

Call this method to insert one array into another.

InsertAt

Call this method to insert a new element (or multiple copies of an element) into the array object.

IsEmpty

Call this method to test if the array is empty.

RemoveAll

Call this method to remove all elements from the array object.

RemoveAt

Call this method to remove one or more elements from the array.

SetAt

Call this method to set the value of an element in the array object.

SetAtGrow

Call this method to set the value of an element in the array object, expanding the array as required.

SetCount

Call this method to set the size of the array object.

Operators

operator []

Call this operator to return a reference to an element in the array.

Typedefs

INARGTYPE

The data type to use for adding elements to the array.

OUTARGTYPE

The data type to use for retrieving elements from the array.

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.

For more information, see ATL Collection Classes.

Requirements

Header: atlcoll.h

See Also

Reference

CArray Class

Concepts

MMXSwarm Sample

DynamicConsumer Sample

UpdatePV Sample

Marquee Sample

Other Resources

ATL Class Overview