On Friday, 20 November 2020 at 14:08:23 UTC, jmh530 wrote:
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);
}

with type functions this syntax should work.

Reply via email to