Insert
Inserts element in the list in the specified position.
int Insert(
CObject* element,
int pos
) |
Parameters
element
[in] value of the element to insert in the list
pos
[in] Position in the list to insert
Return Value
Note
Example:
//--- example for CList::Insert(CObject*,int)
#include <Arrays\List.mqh>
//---
void OnStart()
{
CList *list=new CList;
//---
if(list==NULL)
{
printf("Object create error");
return;
}
//--- insert 100 elements
for(int i=0;i<100;i++)
{
if(list.Insert(new CObject,0)==-1)
{
printf("Element insert error");
delete list;
return;
}
}
//--- use list
//--- . . .
//--- delete list
delete list;
} |