Re: What is the replacement for deprecated array removal

2019-11-18 Thread mipri via Digitalmars-d-learn
On Monday, 18 November 2019 at 21:25:12 UTC, kerdemdemir wrote: It is a bit weird that such a general case like removing list of elements does not work. And I really do not know the real use of [0,1,2,3].remove(1,2,3). I mean in unit test it looks cool but in real life you will have dynamical

Re: What is the replacement for deprecated array removal

2019-11-18 Thread kerdemdemir via Digitalmars-d-learn
On Monday, 18 November 2019 at 21:14:53 UTC, Steven Schveighoffer wrote: On 11/18/19 3:53 PM, kerdemdemir wrote: Is there any way to remove list of elements efficiently with a dynamical array? It seems kind of silly that it's not allowed, but maybe it will be possible after the deprecation i

Re: What is the replacement for deprecated array removal

2019-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/18/19 3:53 PM, kerdemdemir wrote: Is there any way to remove list of elements efficiently with a dynamical array? It seems kind of silly that it's not allowed, but maybe it will be possible after the deprecation is removed. But you could do something like this: list = list.remove!(a

Re: What is the replacement for deprecated array removal

2019-11-18 Thread kerdemdemir via Digitalmars-d-learn
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));

Re: What is the replacement for deprecated array removal

2019-11-18 Thread kerdemdemir via Digitalmars-d-learn
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

Re: What is the replacement for deprecated array removal

2019-11-18 Thread Steven Schveighoffer via Digitalmars-d-learn
On 11/18/19 3:01 PM, kerdemdemir wrote:     int[] removeList;     for ( int i = 0; i < tempMap[0].length; i++ )     {     if ( i%2 == 0 )     removeList ~=i;     }     writeln(removeList); (prints 0,2,4)     tempMap[1].remove(0,2,4);     tempMap[2].remove(removeList);     te

Re: What is the replacement for deprecated array removal

2019-11-18 Thread kerdemdemir via Digitalmars-d-learn
int[] removeList; for ( int i = 0; i < tempMap[0].length; i++ ) { if ( i%2 == 0 ) removeList ~=i; } writeln(removeList); (prints 0,2,4) tempMap[1].remove(0,2,4); tempMap[2].remove(removeList); tempMap[3].remove(tuple(0,1),tuple(2,3),tuple(4,5) );

What is the replacement for deprecated array removal

2019-11-18 Thread kerdemdemir via Digitalmars-d-learn
I know my example can be shortened but please excuse me that I am pasting directly import std.stdio; import std.math; import std.range; import std.algorithm; import std.typecons; int[][4] tempMap; void main() { int[] temp = [ 1, 2, 3 , 4 ,5 ]; tempMap[0] = temp.dup; tempMap[1] =