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

 
You could, of course, ignore the costs and expenses and rewrite an array of any dimension into a newly created 1-dimensional array in #define before calling the function (and then rewrite it back), but the costs will be pitiful.
 
Alexey Viktorov:

Why won't it help?

...

Because neither the number of array dimensions nor the size of any of the dimensions will trigger overloading. And passing parameters that can be defined automatically into a function is not a very wise decision.

 
Dmitry Fedoseev:

Because neither the number of array dimensions nor the size of any of the dimensions will trigger overloading. And passing parameters that can be defined automatically into a function is not exactly a wise decision.

Yes, I've already realised it's a waste of time.

 
All in all, it's a worthwhile topic, but it's very broad and complex for me, something that takes years of experience to get to.
 
Seric29:
All in all, it's a worthwhile topic, but it's very broad and complicated for me, something that takes years of experience to get to.

Don't go into too much detail, they want to make everything too universal, but you can live just fine without it.

 
Actually, in the first reply to the thread, a universal recipe was given. You just have to turn it on and test it yourself, but you can't chew it all up and put it in your mouth, can you?
 
Ilya Malev:
Actually in the first reply of the thread a universal recipe was given. You just need to turn it on and test it yourself, but you can't chew it all up and put it in your mouth, can you?

Ilya, do you really take the topic as something serious? Just to play around and have a little fun... You've given a working answer: everything to a one-dimensional array and back, regardless of dimensionality. My answer is the same as yours, there are only small technical details that don't change the essence. I didn't get the point about the definition and the deplorable costs.

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

Ilya, do you really take the topic as something serious? Just to play around and have a little fun... You've given a working answer: everything to a one-dimensional array and back, regardless of dimensionality. My answer is the same as yours, there are only small technical details that don't change the essence. I don't understand what you mean about the cost and the deplorable cost.

No, on the contrary is not serious, I just TC explained again where to look for a solution (first post is most likely to work, although I did not check). And then started all sorts of chatter :)

Although the situation is sad with these arrays in μl in fact, another thing is that they are not needed in 99% of cases. When you have a head on your shoulders, any coder uses structures or even objects.

The define I wrote solves the problem I set)) - One call to ArrayDel execute code, written by Dmitry, for different arrays. True, this is not a function, but a "dead man's poultice", as they say. Speaking about define costs, if you really want to run an int ar[] parameter for any array, you may do the following (this is a simplification, actually the number of measurements should be passed there as well):


#property strict

#define  PackAndDel(A,S,C) { int tmp[]; ArrayCopy(tmp,A); ArrayDelete(tmp,S,C); ArrayCopy(A,tmp); }

void ArrayDelete(int &ar[], int start, int count)
 {

  // ..... ;

 }



void OnStart ()

{

  int ar1[];

  int ar2[][5];

  int ar3[][6][2];

  PackAndDel( ar1, 0, 1 );

  PackAndDel( ar2, 4, 1 );

  PackAndDel( ar3, 1, 3 );

}