The OpenD Programming Language

hasNested

Determines whether T or any of its representation types have a context pointer.

template hasNested (
T
) {
static if(isStaticArray!T && T.length)
enum hasNested;
static if(!(isStaticArray!T && T.length))
static if(is(T == class) || is(T == struct) || is(T == union))
enum hasNested;
static if(!(isStaticArray!T && T.length))
static if(!(is(T == class) || is(T == struct) || is(T == union)))
enum hasNested;
}

Examples

static struct S { }

int i;
struct NS { void f() { ++i; } }

static assert(!hasNested!(S[2]));
static assert(hasNested!(NS[2]));

Meta