D idom for removing array elements

albert-j via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 26 00:22:09 PST 2017


What is the D idiom for removing array elements that are present 
in another array?

Is this the right/fastest way?

int[] a = [1, 2, 3, 4, 5, 6, 7, 4];
int[] b = [3, 4, 6];
auto c = a.remove!(x => b.canFind(x));
assert(c == [1, 2, 5, 7]);


More information about the Digitalmars-d-learn mailing list