hasElaborateDestructor

Determines whether T has an elaborate destructor.

Only $(D_KEYWORD struct)s and static arrays of $(D_KEYWORD struct)s with the length greater than0 can have elaborate destructors, for all other types $(D_PSYMBOL hasElaborateDestructor) evaluates to $(D_KEYWORD false).

An elaborate destructor is an explicitly defined destructor or one generated by the compiler. The compiler generates a destructor for a $(D_KEYWORD struct) if it has members with an elaborate destructor.

Members

Variables

hasElaborateDestructor
enum bool hasElaborateDestructor;
Undocumented in source.
hasElaborateDestructor
enum bool hasElaborateDestructor;
Undocumented in source.

Parameters

T

A type.

Return Value

$(D_KEYWORD true) if T has an elaborate destructor, $(D_KEYWORD false) otherwise.

Examples

class C
{
    ~this()
    {
    }
}
static assert(!hasElaborateDestructor!C);

static struct S
{
    ~this()
    {
    }
}
static struct S1
{
    S s;
}
static struct S2
{
}
static assert(hasElaborateDestructor!S); // Explicit destructor.
static assert(hasElaborateDestructor!S1); // Compiler-generated destructor.
static assert(!hasElaborateDestructor!S2); // No destructor.

static assert(hasElaborateDestructor!(S[1]));
static assert(!hasElaborateDestructor!(S[0]));

Meta