hasElaborateAssign

True if S or any type directly embedded in the representation of S defines an elaborate assignment. Elaborate assignments are introduced by defining opAssign(typeof(this)) or opAssign(ref typeof(this)) for a struct or when there is a compiler-generated opAssign.

A type S gets compiler-generated opAssign if it has an elaborate destructor.

Classes and unions never have elaborate assignments.

Note: Structs with (possibly nested) postblit operator(s) will have a hidden yet elaborate compiler generated assignment operator (unless explicitly disabled).

template hasElaborateAssign (
S
) {
static if(isStaticArray!S && S.length)
enum bool hasElaborateAssign;
static if(!(isStaticArray!S && S.length))
static if(is(S == struct))
enum hasElaborateAssign;
static if(!(isStaticArray!S && S.length))
static if(!(is(S == struct)))
enum bool hasElaborateAssign;
}

Examples

static assert(!hasElaborateAssign!int);

static struct S  { void opAssign(S) {} }
static assert( hasElaborateAssign!S);
static assert(!hasElaborateAssign!(const(S)));

static struct S1 { void opAssign(ref S1) {} }
static struct S2 { void opAssign(int) {} }
static struct S3 { S s; }
static assert( hasElaborateAssign!S1);
static assert(!hasElaborateAssign!S2);
static assert( hasElaborateAssign!S3);
static assert( hasElaborateAssign!(S3[1]));
static assert(!hasElaborateAssign!(S3[0]));

Meta