List::InsertListElementBefore
Defined in:
Inserts an object before an existing element of a list.
TSList.h
Prototype
void InsertListElementBefore(ListElement<type> *element, ListElement<type> *before);
Parameters
element |
A pointer to the object to add to the list. |
before |
A pointer to the object before which the new object is inserted. This parameter must point to an object that is already a member of the list. |
Description
The InsertListElementBefore
function adds the object specified by the element
parameter to a list at the position before the object specified by the before
parameter. If the object is already a member of the list, then it is moved to the new position. If the before
parameter is nullptr
, then the node is added to the end of the list. Otherwise, the before
parameter must specify an object that is already a member of the list for which this function is called.If the object being added is already a member of a different list of the same type, then it is first removed from that list before being added to the new list.
See Also