isDynamicArray

Detect whether type T is a dynamic array.

template isDynamicArray (
T
) {
static if(is(T == U[], U))
enum bool isDynamicArray;
static if(!(is(T == U[], U)))
static if(is(T U == enum))
enum bool isDynamicArray;
static if(!(is(T == U[], U)))
static if(!(is(T U == enum)))
enum bool isDynamicArray;
}

Examples

static assert( isDynamicArray!(int[]));
static assert( isDynamicArray!(string));
static assert( isDynamicArray!(long[3][]));

static assert(!isDynamicArray!(int[5]));
static assert(!isDynamicArray!(typeof(null)));

Meta