What is the replacement for deprecated array removal

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 18 21:14:53 UTC 2019


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 => removeList.canFind(a));

This is going to suck. Because it's O(n^2). Should be O(n + m) way to do 
it (assuming you have a sorted index list).

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

An AliasSeq is a compile-time construct, and cannot be created from a 
runtime array.

-Steve


More information about the Digitalmars-d-learn mailing list