On Monday, 18 November 2019 at 20:48:40 UTC, kerdemdemir wrote:
On Monday, 18 November 2019 at 20:37:50 UTC, Steven Schveighoffer wrote:
If I follow the code correctly, it's treating your array as a tuple of pos/len to remove.

So it looks like your code is equivalent to

remove(tuple(0, 2));

Which is probably not what you want.

This probably explains why it's being deprecated, it's too confusing to the compiler.

And looking at git blame goes back to this PR: https://github.com/dlang/phobos/pull/6154

-Steve

Sorry to be horrible at explaining but remove(tuple(0, 2)); is not what I want.

I have an array which goes from 0 to 5. And I want to remove odd numbers.

remove(tuple(0, 2)); defines a starting index and a ending index but I need to delete not consecutive elements. In the case of odd number from 0 to 5 that will be 1, 3 and 5 .

It is so weird when you type it is allowed like remove(1, 3, 5) but unexpectedly remove([1,3,5]) does not work the same way.

I think if I can convert [1,3,5] to a AliasSeq that could be ok also.

Erdem

I read your message again now and I see that you weren't suggesting remove(tuple(0, 2)) but you were pointing out it is not what I want as well.

Is there any way to remove list of elements efficiently with a dynamical array?

Or is there anyway converting a dynamical array into a form which is like a AliasSeq?


Erdem

Reply via email to