isIntegral

Detect whether T is a built-in integral type. Types bool, char, wchar, and dchar are not considered integral.

enum bool isIntegral(T);

Examples

1 static assert(
2     isIntegral!byte &&
3     isIntegral!short &&
4     isIntegral!int &&
5     isIntegral!long &&
6     isIntegral!(const(long)) &&
7     isIntegral!(immutable(long))
8 );
9 
10 static assert(
11     !isIntegral!bool &&
12     !isIntegral!char &&
13     !isIntegral!double
14 );
15 
16 // types which act as integral values do not pass
17 struct S
18 {
19     int val;
20     alias val this;
21 }
22 
23 static assert(!isIntegral!S);

Meta

Suggestion Box / Bug Report