Udostępnij za pośrednictwem


CObArray::GetUpperBound

Returns the current upper bound of this array.

INT_PTR GetUpperBound( ) const;

Return Value

The index of the upper bound (zero-based).

Remarks

Because array indexes are zero-based, this function returns a value 1 less than GetSize.

The condition GetUpperBound( ) = –1 indicates that the array contains no elements.

The following table shows other member functions that are similar to CObArray::GetUpperBound.

Class

Member Function

CByteArray

INT_PTR GetUpperBound( ) const;

CDWordArray

INT_PTR GetUpperBound( ) const;

CPtrArray

INT_PTR GetUpperBound( ) const;

CStringArray

INT_PTR GetUpperBound( ) const;

CUIntArray

INT_PTR GetUpperBound( ) const;

CWordArray

INT_PTR GetUpperBound( ) const;

Example

See CObList::CObList for a listing of the CAge class used in all collection examples.

CObArray arr;

arr.Add(new CAge(21)); // Element 0
arr.Add(new CAge(40)); // Element 1
ASSERT(arr.GetUpperBound() == 1); // Largest index      

Requirements

Header: afxcoll.h

See Also

Reference

CObArray Class

Hierarchy Chart

CObArray::GetSize

CObArray::SetSize

Other Resources

CObArray Members