@@ -66,7 +66,7 @@ template Unqual(T)
66
66
}
67
67
68
68
// [For internal use]
69
- package template ModifyTypePreservingTQ(alias Modifier, T)
69
+ template ModifyTypePreservingTQ (alias Modifier, T)
70
70
{
71
71
static if (is (T U == immutable U)) alias ModifyTypePreservingTQ = immutable Modifier! U;
72
72
else static if (is (T U == shared inout const U)) alias ModifyTypePreservingTQ = shared inout const Modifier! U;
@@ -78,6 +78,19 @@ package template ModifyTypePreservingTQ(alias Modifier, T)
78
78
else static if (is (T U == const U)) alias ModifyTypePreservingTQ = const Modifier! U;
79
79
else alias ModifyTypePreservingTQ = Modifier! T;
80
80
}
81
+ @safe unittest
82
+ {
83
+ alias Intify (T) = int ;
84
+ static assert (is (ModifyTypePreservingTQ! (Intify, real ) == int ));
85
+ static assert (is (ModifyTypePreservingTQ! (Intify, const real ) == const int ));
86
+ static assert (is (ModifyTypePreservingTQ! (Intify, inout real ) == inout int ));
87
+ static assert (is (ModifyTypePreservingTQ! (Intify, inout const real ) == inout const int ));
88
+ static assert (is (ModifyTypePreservingTQ! (Intify, shared real ) == shared int ));
89
+ static assert (is (ModifyTypePreservingTQ! (Intify, shared const real ) == shared const int ));
90
+ static assert (is (ModifyTypePreservingTQ! (Intify, shared inout real ) == shared inout int ));
91
+ static assert (is (ModifyTypePreservingTQ! (Intify, shared inout const real ) == shared inout const int ));
92
+ static assert (is (ModifyTypePreservingTQ! (Intify, immutable real ) == immutable int ));
93
+ }
81
94
82
95
// Substitute all `inout` qualifiers that appears in T to `const`
83
96
template substInout (T)
0 commit comments