On Sunday, 16 May 2021 at 20:32:08 UTC, SealabJaster wrote:
...
You could even make a helper function that lets the compiler infer the lambda's type for you:
```d
struct S(T)
{
alias FT = T function(T);
FT func;
}
S!T s(T)(T function(T) func)
{
return S!T(func);
}
void main()
{
auto a = S!int(a => a*2);
auto b = s((int a) => a+2);
a = b;
}
```
But that can give you awful looking error messages if you forget
to add the param typing.
