Hello everyone The situation is such that the expert Advisor used an array of pointers to the object
class – all is well:
MyClass{
public:
int a;
void MyClass(int i){
this.a=i;
}
void test()
{
Print("test: "+(string)this.a);
}
};
MyClass *test[];
int size=10;
ArrayResize(test, size);
for(int i=0; inew MyClass(i);
}
Then I quietly deleted them with the delete statement
for(int i=0; idelete test[i];
}
ArrayResize(test, 0);
But the new feature, now I don’t need to remove the entire array, and leave some of them, I was looking up how to clone an object not found, I searched both
to reindex the array is also not found… I need about the implementation of a trail situation:
for(int i=0; i2){
delete test[i];
}
//we get
//test[1] object
//test[3] object
//test[5] object
//test[7] object
//test[9] object
//Here you need to somehow reindex the entire array test[] and get the output
test[0].test(); //1
test[1].test(); //3
test[2].test(); //5
test[3].test(); //7
test[4].test(); //9
Tell me how to implement this in mql4?
twg
Thank you all – I figured it out! I just deleted the buffer array ahead of time, as a result of which I cleaned the main pointers and got invalid pointer
access
… here is a purely Russian approach.
Memory leaks are fixed! =)
denkir
A typical task for a list. Take a closer look at the appropriate class.
In MQL4, it also works.
tara
Nothing works at all.
igorm
today, the search does not work, I also dealt with this issue last year, the search for my typedef messages should be found
or as an option, I posted a panel in C# in the blog, there I also tied it to an array of function pointers-almost one – to-one as Your task