What is the replacement for deprecated array removal
kerdemdemir
kerdemdemir at gmail.com
Mon Nov 18 20:48:40 UTC 2019
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
More information about the Digitalmars-d-learn
mailing list