IndexOf

Obtém o índice do item da lista.

int  IndexOf(
   CObject*  element      // Pointer to the element
   )

Parâmetros

element

[in] Ponteiro para o item da lista.

Valor do Retorno

Item de índice na lista, ou -1.

Exemplo

//--- example for CList::IndexOf(CObject*) 
#include <Arrays\List.mqh> 
//--- 
void OnStart() 
  { 
   CList *list=new CList; 
   //--- 
   if(list==NULL
     { 
      printf("Object create error"); 
      return
     } 
   CObject *object=new CObject; 
   if(object==NULL
     { 
      printf("Element create error"); 
      delete list; 
      return
     } 
   if(list.Add(object)) 
     { 
      int pos=list.IndexOf(object); 
     } 
   //--- delete list 
   delete list; 
  }