Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Adds an element to this list before the element at the specified position.
POSITION InsertBefore(
POSITION position,
ARG_TYPE newElement
);
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.
Return Value
A POSITION value that can be used for iteration or list element retrieval.
Remarks
If position is NULL, the element is inserted at the head of the list.
Example
// Define myList.
CList<CString,CString&> myList;
// Add three elements to the list.
POSITION pos = myList.AddHead(CString(_T("XYZ")));
pos = myList.InsertBefore(pos, CString(_T("ABC")));
pos = myList.InsertBefore(pos, CString(_T("123")));
// Verify the head element is what's expected.
ASSERT(CString(_T("123")) == myList.GetHead());
Requirements
Header: afxtempl.h