2

Is there any existing implementation of list of string, integer etc. where we can add element, remove element directly, without caring of the size of the arrays?

william007
  • 17,375
  • 25
  • 118
  • 194

1 Answers1

2
#include <Object.mqh>
#include <Arrays\ArrayObj.mqh>

class CElementInt : public CObject{
    int m_value;                  
                    CElement(const int value){m_value=value);
                   ~CElement(){}
};

CArrayObj *list;

int OnInit(){
     list = new CArrayObj();
     return(INIT_SUCCEEDED);
}

void OnTick(){
     if(TRUE){
        list.Add(new CElement(100));
     }else{
        list.Delete(new CElement(100));
     }
}

You can add any kind of Cobject and its relatives classes into CArrayObj.

user3666197
  • 1
  • 6
  • 50
  • 92
Daniel Kniaz
  • 4,603
  • 2
  • 14
  • 20