On Thursday, 3 August 2017 at 12:31:00 UTC, Adam D. Ruppe wrote:
On Thursday, 3 August 2017 at 12:24:02 UTC, data pulverizer
wrote:
import std.traits: isIntegral, isNumeric;
Are you familiar with isFloatingPoint?
http://dpldocs.info/experimental-docs/std.traits.isFloatingPoint.html
if(is(T: double) && isNumeric!T)
Keep in mind that T:double here means "if T can implicitly
convert to double". Since int can implicitly convert to double
too, this case covers both families!
You might want to try == instead of : for a more exact match.
Thank you very much!
What about this case:
```
T test(T: double)(T x, T y)
{
return x*y;
}
auto test(T)(T x, T y)
{
return 5*test!double(x, y);
}
```
which also gives:
```
int test: 4
double test: 4
```