hasElaborateCopyConstructor

True if S or any type embedded directly in the representation of S defines an elaborate copy constructor. Elaborate copy constructors are introduced by defining this(this) for a struct.

Classes and unions never have elaborate copy constructors.

template hasElaborateCopyConstructor (
S
) {}

Examples

1 static assert(!hasElaborateCopyConstructor!int);
2 
3 static struct S1 { }
4 static struct S2 { this(this) {} }
5 static struct S3 { S2 field; }
6 static struct S4 { S3[1] field; }
7 static struct S5 { S3[] field; }
8 static struct S6 { S3[0] field; }
9 static struct S7 { @disable this(); S3 field; }
10 static assert(!hasElaborateCopyConstructor!S1);
11 static assert( hasElaborateCopyConstructor!S2);
12 static assert( hasElaborateCopyConstructor!(immutable S2));
13 static assert( hasElaborateCopyConstructor!S3);
14 static assert( hasElaborateCopyConstructor!(S3[1]));
15 static assert(!hasElaborateCopyConstructor!(S3[0]));
16 static assert( hasElaborateCopyConstructor!S4);
17 static assert(!hasElaborateCopyConstructor!S5);
18 static assert(!hasElaborateCopyConstructor!S6);
19 static assert( hasElaborateCopyConstructor!S7);

Meta

Suggestion Box / Bug Report