CAtlList::FindIndex
Call this method to obtain the position of an element, given an index value.
POSITION FindIndex(
size_t iElement
) const throw( );
Parameters
- iElement
The zero-based index of the required list element.
Return Value
Returns the corresponding POSITION value, or NULL if iElement is out of range.
Remarks
This method returns the POSITION corresponding to a given index value, allowing access to the nth element in the list.
In debug builds, an assertion failure will occur if the list object is not valid.
Example
// Define the integer list
CAtlList<int> myList;
// Populate the list
for (int i = 0; i < 100; i+)
{
myList.AddTail(i);
}
// Iterate through the entire list
for (size_t j = 0; j < myList.GetCount(); j+)
{
size_t i = myList.GetAt(myList.FindIndex(j));
ATLASSERT(i == j);
}
Requirements
Header: atlcoll.h