CUIntArray Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at CUIntArray Class.

Supports arrays of unsigned integers.

class CUIntArray : public CObject  

The member functions of CUIntArray are similar to the member functions of class CObArray. Because of this similarity, you can use the CObArray reference documentation for member function specifics. Wherever you see a CObject pointer as a function parameter or return value, substitute a UINT.

CObject* CObArray::GetAt( int <nIndex> ) const;

for example, translates to

UINT CUIntArray::GetAt( int <nIndex> ) const;

Public Constructors

NameDescription
CObArray::CObArrayConstructs an empty array.

Public Methods

NameDescription
CObArray::AddAdds an element to the end of the array; grows the array if necessary.
CObArray::AppendAppends another array to the array; grows the array if necessary.
CObArray::CopyCopies another array to the array; grows the array if necessary.
CObArray::ElementAtReturns a temporary reference to the element pointer within the array.
CObArray::FreeExtraFrees all unused memory above the current upper bound.
CObArray::GetAtReturns the value at a given index.
CObArray::GetCountGets the number of elements in this array.
CObArray::GetDataAllows access to elements in the array. Can be NULL.
CObArray::GetSizeGets the number of elements in this array.
CObArray::GetUpperBoundReturns the largest valid index.
CObArray::InsertAtInserts an element (or all the elements in another array) at a specified index.
CObArray::IsEmptyDetermines if the array is empty.
CObArray::RemoveAllRemoves all the elements from this array.
CObArray::RemoveAtRemoves an element at a specific index.
CObArray::SetAtSets the value for a given index; array not allowed to grow.
CObArray::SetAtGrowSets the value for a given index; grows the array if necessary.
CObArray::SetSizeSets the number of elements to be contained in this array.

Public Operators

NameDescription
CObArray::operator [ ]Sets or gets the element at the specified index.

An unsigned integer, or UINT, differs from words and doublewords in that the physical size of a UINT can change depending on the target operating environment. A UINT is the same size as a doubleword.

CUIntArray incorporates the [IMPLEMENT_DYNAMIC]--brokenlink--(../Topic/not%20found.md#implement_dynamic) macro to support run-time type access and dumping to a CDumpContext object. If you need a dump of individual unsigned integer elements, you must set the depth of the dump context to 1 or greater. Unsigned integer arrays cannot be serialized.

System_CAPS_ICON_note.jpg Note

Before using an array, use SetSize to establish its size and allocate memory for it. If you do not use SetSize, adding elements to your array causes it to be frequently reallocated and copied. Frequent reallocation and copying are inefficient and can fragment memory.

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

CObject

CUIntArray

Header: afxcoll.h

CObject Class
Hierarchy Chart

Show: