View source code
Display the source code in std/traits.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Alias std.traits.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
.
alias hasElaborateCopyConstructor(S)
= hasElabCCtor!S;
Classes and unions never have elaborate copy constructors.
Example
static assert(!hasElaborateCopyConstructor!int);
static struct S1 { }
static struct S2 { this(this) {} }
static struct S3 { S2 field; }
static struct S4 { S3[1] field; }
static struct S5 { S3[] field; }
static struct S6 { S3[0] field; }
static struct S7 { @disable this(); S3 field; }
static assert(!hasElaborateCopyConstructor!S1);
static assert( hasElaborateCopyConstructor!S2);
static assert( hasElaborateCopyConstructor!(immutable S2));
static assert( hasElaborateCopyConstructor!S3);
static assert( hasElaborateCopyConstructor!(S3[1]));
static assert(!hasElaborateCopyConstructor!(S3[0]));
static assert( hasElaborateCopyConstructor!S4);
static assert(!hasElaborateCopyConstructor!S5);
static assert(!hasElaborateCopyConstructor!S6);
static assert( hasElaborateCopyConstructor!S7);
Authors
Walter Bright,
Tomasz Stachowiak (isExpressions
),
Andrei Alexandrescu,
Shin Fujishiro,
Robert Clipsham,
David Nadlinger,
Kenji Hara,
Shoichi Kato
License
Copyright © 1999-2022 by the D Language Foundation | Page generated by ddox.