1 module dstruct.support;
2 
3 import std.traits;
4 
5 // Define a do-nothing nogc attribute so @nogc can be used,
6 // but functions tagged with it will still compile in
7 // older D compiler versions.
8 static if (__VERSION__ < 2066) { enum nogc = 1; }
9 
10 /**
11  * true if a type T can be duplicated through some means.
12  */
13 template isDupable(T) {
14     enum isDupable =
15         // Implicit conversion from const to non-const is allowed.
16         is(const(Unqual!T) : Unqual!T);
17 }
18 
19 enum isAssignmentCopyable(T) = is(typeof(
20     (inout int _ = 0) {
21         T value = T.init;
22 
23         T value2 = value;
24     }
25 ));
26