lambdas with types
jmh530
john.michael.hall at gmail.com
Fri Nov 20 14:08:23 UTC 2020
Doing something like below fails because I don't seem to be able
to make a templated lambda that just takes types. Is the only way
to do something similar to create a separate function to handle
the condition, or is there some other way to do something with
similar flexibility?
import std.stdio: writeln;
import std.meta: allSatisfy;
void foo(Args...)(Args args)
if (allSatisfy!(x => is(x == double), Args))
{
writeln("works");
}
void main() {
foo(1.0, 2.0);
}
More information about the Digitalmars-d-learn
mailing list