hasElaborateCopyConstructor

Determines whether T has an elaborate postblit constructor.

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

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

Members

Variables

hasElaborateCopyConstructor
enum bool hasElaborateCopyConstructor;
Undocumented in source.
hasElaborateCopyConstructor
enum bool hasElaborateCopyConstructor;
Undocumented in source.

Parameters

T

A type.

Return Value

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

Examples

static assert(!hasElaborateCopyConstructor!int);

static struct S
{
    this(this)
    {
    }
}
static struct S1
{
    S s;
}
static struct S2
{
}
static assert(hasElaborateCopyConstructor!S); // Explicit destructor.
static assert(hasElaborateCopyConstructor!S1); // Compiler-generated destructor.
static assert(!hasElaborateCopyConstructor!S2); // No destructor.
static assert(hasElaborateCopyConstructor!(S[1]));
static assert(!hasElaborateCopyConstructor!(S[0]));

Meta