cannot use local __lambda1 as parameter to non-global template
aliak
something at something.com
Fri Jul 26 16:20:10 UTC 2019
Can someone help me understand the details around why this fails?
import std;
struct W(T) {
T value;
auto hook(handlers...)() {
return handlers[0](value);
}
}
template f(handlers...) {
auto ref f(T)(auto ref T value) {
return value.hook!handlers;
}
}
@nogc void main() {
auto a = W!int(3);
auto b = a.f!((_) => "yes");
}
If I specifically type the lambda I pass in to f (i.e. (int _) =>
"yes") then it works. Or if I make hook a global template that
takes a W!T as the first parameter it also works. Is there a work
around for this?
More information about the Digitalmars-d-learn
mailing list