Skip to content
Browse files

Merge pull request #24 from lgvz/refactor

Refactor TupleRange
  • Loading branch information...
2 parents b6391e3 + 11a10ae commit 390afda0999c2ac47e2f860a844428848bd2e615 @Dav1dde committed Dec 6, 2013
Showing with 4 additions and 8 deletions.
  1. +4 −8 gl3n/util.d
View
12 gl3n/util.d
@@ -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 390afda

Please sign in to comment.
Something went wrong with that request. Please try again.