CList::InsertBefore

POSITION InsertBefore( POSITION position, ARG_TYPE newElement );

Return Value

A POSITION value that can be used for iteration or list element retrieval; NULL if the list is empty.

Parameters

position

A POSITION value returned by a previous GetNext, GetPrev, or Find member function call.

ARG_TYPE

Template parameter specifying the type of the list element (can be a reference).

newElement

The element to be added to this list.

Remarks

Adds an element to this list before the element at the specified position.

Example

// Define myList.
CList<CString,CString&> myList;

// Add three elements to the list.
POSITION pos = myList.AddHead(CString("XYZ"));
pos = myList.InsertBefore(pos, CString("ABC"));
pos = myList.InsertBefore(pos, CString("123"));

// Verify the head element is what's expected.
ASSERT(CString("123") == myList.GetHead());

CList OverviewClass MembersHierarchy Chart

See Also   CList::Find, CList::InsertAfter