Type constraint

Joel joelcnz at gmail.com
Tue Oct 3 11:43:46 UTC 2023


I’ve got a struct that has a method that adds numbers together. I 
want to do something like this, static if (isInteger!T) … but it 
isn’t working. static if (is(T==int)) works for one integer type.

```d
struct List(T) {
      auto addUp()
          If (isInteger!T) {
              (Add numbers)
          }
     }
}
```


More information about the Digitalmars-d-learn mailing list