Skip to content

Commit

Permalink
Merge pull request #113 from kennytm/bug5873
Browse files Browse the repository at this point in the history
Issue 5873 - Cannot call iota() on long with step
  • Loading branch information
andralex committed Jun 22, 2011
2 parents c5b8bf1 + 252c29b commit d6c471b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion std/range.d
Expand Up @@ -3897,7 +3897,8 @@ if ((isIntegral!(CommonType!(B, E)) || isPointer!(CommonType!(B, E)))
ret.pastLast -= (this.length - upper) * step;
return ret;
}
@property size_t length() const
//@@@BUG4040@@@ Can't use 'auto' return when 'const' is on the right.
@property typeof(unsigned((pastLast - current) / step)) length() const
{
return unsigned((pastLast - current) / step);
}
Expand Down Expand Up @@ -4133,6 +4134,11 @@ unittest
// iota of longs
auto rl = iota(5_000_000L);
assert(rl.length == 5_000_000L);

// iota of longs with steps
auto iota_of_longs_with_steps = iota(50L, 101L, 10);
assert(iota_of_longs_with_steps.length == 6);
assert(equal(iota_of_longs_with_steps, [50L, 60L, 70L, 80L, 90L, 100L]));
}

unittest
Expand Down

0 comments on commit d6c471b

Please sign in to comment.