On Tuesday, 10 May 2022 at 13:14:20 UTC, Salih Dincer wrote:

must satisfy the following constraint:

That is your type protection here, a constraint.

Alternatively you can put the constraint in a function and make it more verbose:

```d
bool isAllowedType(T)()
{
    static assert(!is(T == bool), "Nope");
    return true;
}

void fun(T = int)(T arg)
if(isAllowedType!T)
{
    //..
}

fun(0);      // ok
fun(false);  // not allowed
```

Reply via email to