D-Programming-Language/phobos — pull request #1851 by monarchdodra (2014-01-12 11:10:05+00:00)
Title: Fixes in Cycle

2 fixes:

1) Fix overflow when cycle does more than size_t iterations: The previous implementation never reset `index`, and instead always used `index % length`. This works until `index` wraps around, at whic point it breaks.

The fix is to simple check if a full cycle has been done. It also avoids doing a modulo operation *just* to call front.

2) Trivially trivial, https://d.puremagic.com/issues/show_bug.cgi?id=10845 , There was a missing `save` in `popFront`.

Also added unittets.