On Monday, 15 January 2018 at 13:55:57 UTC, Nordlöw wrote:
Why do I get errors like
template instance remove!((_) => _ == 1) cannot use local
'__lambda5' as parameter to non-global template remove()(in K
key)
for
x.remove!(_ => _ == 1);
but not for
x.remove!"a == 11";
?
How are these two lambdas different?
The function `remove` is a templated member of a struct
instance `x`.
Can you give a bit more context? The following code does not
cause a compile error:
import std.stdio;
import std.algorithm;
void main()
{
auto arr = [1, 2, 3];
arr.remove!(_ => _ == 1);
writeln(arr);
}
Or was that code meant as an example?