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

Ferhat Kurtulmuş aferust at gmail.com
Fri Feb 3 15:57:16 UTC 2023


On Friday, 3 February 2023 at 15:53:35 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
> ```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]

Thank you very much. I am surprised that I couldn't find it using 
many keywords on the site and google.


More information about the Digitalmars-d-learn mailing list