Recommendations on avoiding range pipeline type hell
SealabJaster
sealabjaster at gmail.com
Sun May 16 21:05:12 UTC 2021
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.
More information about the Digitalmars-d-learn
mailing list