How do I remove an element from an array (one-dimensional two-dimensional)? - page 4

 
Dmitry Fedoseev:

Which methods? What signatures?

Any methods.

 
Ilya Malev:

Any methods.

What's that got to do with it?

 
Dmitry Fedoseev:

Yes, we work like with one-dimensional. We don't need to describe the data structure - we read everything in a row.

 
ArrayCopy() works with pointers.
 
Dmitry Fedoseev:

What's that got to do with it?

You can't define a function (e.g., delete an element) with the same name (e.g., ArrayRemove) defined the same way for arrays of different sizes (unless you're an MQL compiler developer)

In addition, you will not be able to define such a function with the same name, overloading several variants of calls

You'll have to write it like this

ArrayRemove(var&[],int)

ArrayRemove2(var&[][],int)

ArrayRemove3(var&[][],int)

ArrayRemove4(var&[][][][],int)

So handling a multidimensional array as a one-dimensional array makes no sense either, unless you want to redefine all array functions anew in each of the classes that use them

 
All righty, then.
 
Ilya Malev:

You cannot define a function (e.g. removing an element) with the same name (e.g. ArrayRemove) defined in the same way for arrays of different sizes (unless you are an MQL compiler developer)

In addition, you will not be able to define such a function with the same name, overloading several variants of calls

You'll have to write it like this

ArrayRemove(var&[],int)

ArrayRemove2(var&[][],int)

ArrayRemove3(var&[][],int)

ArrayRemove4(var&[][][][],int)

So handling a multidimensional array as a one-dimensional array makes no sense, unless you want to redefine all array functions anew in each class that uses them

Yes, but that's not such a bad thing.

 
Ilya Malev:

You cannot define a function (e.g. removing an element) with the same name (e.g. ArrayRemove) defined in the same way for arrays of different sizes (unless you are an MQL compiler developer)

In addition, you will not be able to define such a function with the same name, overloading several variants of calls

You'll have to write it like this

ArrayRemove(var&[],int)

ArrayRemove2(var&[][],int)

ArrayRemove3(var&[][],int)

ArrayRemove4(var&[][][][],int)

So handling a multidimensional array as a one-dimensional array makes no sense, unless you want to redefine all functions of working with arrays again in each of the classes that use them

Ilya, you're going from programming technique to problem statement.

Crawl backwards, do things backwards.

My granddaughter is already asleep, otherwise she would have drawn your attention to the fact that the array elements in MT memory are continuously arranged.

 
Алексей Тарабанов:

the array elements in MT memory are arranged continuously.

And what do you think this has to do with the task at hand (class of tasks - unified work with arrays of different dimensions via functions)?

 

For example, you want to make a function to remove an element from an array regardless of its dimensionality. Or you want to make a class that works with arrays of different dimensions. Do you think you can do that in mql?

Reason: