Merge pull request #46 from dukc/copyableUnits
Allowed copying of tagged unions containing unit values
This commit is contained in:
commit
c658b37bdb
|
@ -39,6 +39,7 @@ align(commonAlignment!(UnionKindTypes!(UnionFieldEnum!U))) struct TaggedUnion
|
|||
{
|
||||
import std.traits : FieldTypeTuple, FieldNameTuple, Largest,
|
||||
hasElaborateCopyConstructor, hasElaborateDestructor, isCopyable;
|
||||
import std.meta : templateOr;
|
||||
import std.ascii : toUpper;
|
||||
|
||||
alias FieldDefinitionType = U;
|
||||
|
@ -104,7 +105,7 @@ align(commonAlignment!(UnionKindTypes!(UnionFieldEnum!U))) struct TaggedUnion
|
|||
}
|
||||
|
||||
// postblit constructor
|
||||
static if (!allSatisfy!(isCopyable, FieldTypes)) {
|
||||
static if (!allSatisfy!(templateOr!(isCopyable, isUnitType), FieldTypes)) {
|
||||
@disable this(this);
|
||||
} else static if (anySatisfy!(hasElaborateCopyConstructor, FieldTypes)) {
|
||||
this(this)
|
||||
|
|
Loading…
Reference in a new issue