Are there some helpers in Phobos equivalent to std::set_difference of ugly c++

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Fri Feb 3 15:53:35 UTC 2023


```d
import std.stdio, std.algorithm.setops, std.array;

void main() {
     int[] v1 = [1, 2, 5, 5, 5, 9];
     int[] v2 = [2, 5, 7];
     int[] v3 = setDifference(v1, v2).array;

     writefln!"%s \\ %s = %s"(v1, v2, v3);
}
```

[1, 2, 5, 5, 5, 9] \ [2, 5, 7] = [1, 5, 5, 9]


More information about the Digitalmars-d-learn mailing list