I have asked for remove before, I got some responses here (in fact, Jonathan made an enhancement request for it):
http://www.digitalmars.com/d/archives/digitalmars/D/learn/Removing_an_object_from_a_range_23212.html The topic was derailed, but essentially you can provide a predicate as a function literal to do the work: import std.stdio; import std.algorithm; void main() { int[] elements = [1, 2, 3, 2, 4]; int needle = 2; elements = remove!((item) {return item == needle;} )(elements); assert(elements == [1, 3, 4]); }
