Do you have a better way to remove element from a array?

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 5 08:25:42 PST 2015


bachmeier:

> It seems your argument is that remove is poorly designed 
> because it's not destructive. Or am I missing your argument?

It has to be a void function (or perhaps bettter it can return 
true/false if it has removed the item, so it becomes @nogc and 
nothrow).
And it has to remove the first item equal to the given one.
You can then add a second function that removes at a given index 
(like removeAt).

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list