Re: std way to remove multiple indices from an array at once

2017-12-22 Thread aliak via Digitalmars-d-learn
On Thursday, 21 December 2017 at 15:59:44 UTC, Steven Schveighoffer wrote: Here's a similar solution with an actual range: https://run.dlang.io/is/gR3CjF Note, all done lazily. However, the indices must be sorted/unique. -Steve Noice! :D

Re: std way to remove multiple indices from an array at once

2017-12-21 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/20/17 7:52 PM, Nicholas Wilson wrote: On Thursday, 21 December 2017 at 00:23:08 UTC, Steven Schveighoffer wrote: On 12/20/17 6:01 PM, aliak wrote: Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code

Re: std way to remove multiple indices from an array at once

2017-12-21 Thread aliak via Digitalmars-d-learn
On Thursday, 21 December 2017 at 00:52:29 UTC, Nicholas Wilson wrote: On Thursday, 21 December 2017 at 00:23:08 UTC, Steven Schveighoffer wrote: I'm assuming here indices is sorted? Because it appears you expect that in your code. However, I'm going to assume it isn't sorted at first. auto

Re: std way to remove multiple indices from an array at once

2017-12-20 Thread Nicholas Wilson via Digitalmars-d-learn
On Thursday, 21 December 2017 at 00:23:08 UTC, Steven Schveighoffer wrote: On 12/20/17 6:01 PM, aliak wrote: Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a

Re: std way to remove multiple indices from an array at once

2017-12-20 Thread Seb via Digitalmars-d-learn
On Wednesday, 20 December 2017 at 23:01:17 UTC, aliak wrote: Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a better way? Also, can the below be made more

Re: std way to remove multiple indices from an array at once

2017-12-20 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/20/17 6:01 PM, aliak wrote: Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a better way? Also, can the below be made more efficient? auto without(T, R)(T[]

std way to remove multiple indices from an array at once

2017-12-20 Thread aliak via Digitalmars-d-learn
Hi, is there a way to remove a number of elements from an array by a range of indices in the standard library somewhere? I wrote one (code below), but I'm wondering if there's a better way? Also, can the below be made more efficient? auto without(T, R)(T[] array, R indices) if