如何与 D 中的数组相交?

How to intersect to array in D?

我需要找出 D 中两个字符串数组之间的区别。问题是我无法理解如何使用 std.algorithm 中的 SetDifference

    auto x = SetDifference(filearr1,filearr2);

得到错误:

Error: struct std.algorithm.SetDifference cannot deduce function from argument types !()(string[], string[]), candidates are:

使用 setDifference 小写 "s"。

SetDifferencesetDifference 返回的类型的名称,它恰好是一个模板结构。编译器无法自动从结构中确定模板参数,只能从函数调用中确定,这就是为什么大多数模板结构都存在辅助函数的原因。