Removal from std.container.Array.

Ty Overby ty at pre-alpha.com
Mon Feb 10 13:47:34 PST 2014


So I'm using a std.container.Array for storing systems in my 
program, and I need to search through the array to find the 
system that I want to remove and then shift from that.

In Java I'd write

     ArrayList<System> systems;
     ....
     systems.remove(system);

And in D I was hoping to write

     Array!System systems;
     ....
     systems.linearRemove(systems.equalRange(system));

But for some reason equalRange isn't defined on 
std.container.Array, nor is it a module function.

I also tried

     systems.linearRemove(systems[].filter!(a => a == system));

but FilterResult isn't the same type as Array.Range.


I have to be missing something really basic.  It couldn't 
possibly be this hard to remove an element from an array.


More information about the Digitalmars-d-learn mailing list