canUseAsArray

template canUseAsArray (
R
) {
enum canUseAsArray;
}

Examples

1 static assert(  canUseAsArray!(int[]) );
2 static assert(  canUseAsArray!(int[3]) );
3 static assert(  canUseAsArray!(float[]) );
4 
5 static struct Vec0 { float[] data; alias data this; }
6 static assert(  canUseAsArray!Vec0 );
7 
8 static struct Vec1 { float[] data; }
9 static assert( !canUseAsArray!Vec1 );
10 
11 static struct Vec2 { float[3] data; alias data this; }
12 static assert(  canUseAsArray!Vec2 );
13 
14 static assert( !canUseAsArray!(string) );
15 static assert( !canUseAsArray!(wstring) );
16 static assert( !canUseAsArray!int );
17 static assert( !canUseAsArray!float );
18 static assert( !canUseAsArray!(immutable(void)[]) );

Meta