hasDefaultConstructor

Indicates wether a class has a default constructor.

template hasDefaultConstructor (
C
) if (
is(C == class)
) {
enum hasDefaultConstructor;
}

Examples

1 class A{}
2 class B{this() const {}}
3 class C{this(int a){}}
4 class D{this(){} this(int a){}}
5 
6 static assert(!hasDefaultConstructor!A);
7 static assert( hasDefaultConstructor!B);
8 static assert(!hasDefaultConstructor!C);
9 static assert( hasDefaultConstructor!D);

Meta