| 1 |
module imports.diag9210stdtraits; |
| 2 |
|
| 3 |
template FloatingPointTypeOf(T)// if (!is(T == enum)) |
| 4 |
{ |
| 5 |
inout( float) idx( inout( float) ); |
| 6 |
inout(double) idx( inout(double) ); |
| 7 |
inout( real) idx( inout( real) ); |
| 8 |
shared(inout float) idx( shared(inout float) ); |
| 9 |
shared(inout double) idx( shared(inout double) ); |
| 10 |
shared(inout real) idx( shared(inout real) ); |
| 11 |
|
| 12 |
immutable( float) idy( immutable( float) ); |
| 13 |
immutable(double) idy( immutable(double) ); |
| 14 |
immutable( real) idy( immutable( real) ); |
| 15 |
|
| 16 |
static if (is(typeof(idx(T.init)) X)) |
| 17 |
{ |
| 18 |
alias X FloatingPointTypeOf; |
| 19 |
} |
| 20 |
else static if (is(typeof(idy(T.init)) X)) |
| 21 |
{ |
| 22 |
alias X FloatingPointTypeOf; |
| 23 |
} |
| 24 |
else |
| 25 |
{ |
| 26 |
static assert(0, T.stringof~" is not a floating point type"); |
| 27 |
} |
| 28 |
} |
| 29 |
|
| 30 |
template isFloatingPoint(T) |
| 31 |
{ |
| 32 |
enum bool isFloatingPoint = is(FloatingPointTypeOf!T); |
| 33 |
} |