Permalink
Browse files

Refactor TupleRange

  • Loading branch information...
1 parent b6391e3 commit 11a10ae970678c2a44c120d3fc33117a5d0ede54 Tero Hänninen committed Dec 6, 2013
Showing with 4 additions and 8 deletions.
  1. +4 −8 gl3n/util.d
View
@@ -78,14 +78,10 @@ unittest {
assert(!is_plane!float);
}
-template TupleRange(int from, int to) {
- alias TupleRangeImpl!(to-1, from) TupleRange;
-}
-
-private template TupleRangeImpl(int to, int now) {
- static if(now >= to) {
- alias TypeTuple!(now) TupleRangeImpl;
+template TupleRange(int from, int to) if (from <= to) {
+ static if (from >= to) {
+ alias TupleRange = TypeTuple!();
} else {
- alias TypeTuple!(now, TupleRangeImpl!(to, now+1)) TupleRangeImpl;
+ alias TupleRange = TypeTuple!(from, TupleRange!(from + 1, to));
}
}

0 comments on commit 11a10ae

Please sign in to comment.