@@ -114,7 +114,7 @@ enum hasToHash(T) = __traits(hasMember, T, "toHash");
114114static if (__VERSION__ < 2094 )
115115 enum isCopyable (S) = is (typeof ({ S foo = S.init; S copy = foo; }));
116116else
117- enum isCopyable (S) = __traits(isCopyable, S);
117+ enum isCopyable (S) = __traits(isCopyable, S);
118118enum isPOD (T) = __traits(isPOD, T);
119119enum Sizeof (T) = T.sizeof;
120120
@@ -136,20 +136,14 @@ enum hasSemiMutableConstruction(T) = __traits(compiles, {static struct S { T a;
136136 static assert (hasInoutConstruction! S);
137137}
138138
139- template staticIsSorted (alias cmp, Seq... )
140- {
141- static if (Seq.length <= 1 )
142- enum staticIsSorted = true ;
143- else static if (Seq.length == 2 )
144- enum staticIsSorted = cmp! (Seq[0 ], Seq[1 ]);
145- else
139+ enum staticIsSorted (alias cmp, items... ) =
146140 {
147- enum staticIsSorted =
148- cmp ! (Seq[($ / 2 ) - 1 ], Seq[$ / 2 ]) &&
149- staticIsSorted ! (cmp, Seq[ 0 .. $ / 2 ]) &&
150- staticIsSorted ! (cmp, Seq[$ / 2 .. $]) ;
151- }
152- }
141+ static if (items.length > 1 )
142+ static foreach (i, item; items[ 1 .. $])
143+ static if (cmp ! (items[i], item))
144+ if (__ctfe) return false ;
145+ return true ;
146+ }();
153147
154148template TryRemoveConst (T)
155149{
0 commit comments