Bug 4456 – std.range Recurrence is horribly broken

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-07-13T17:28:00Z
Last change time
2010-07-13T18:17:32Z
Assigned to
andrei
Creator
yebblies

Comments

Comment #0 by yebblies — 2010-07-13T17:28:36Z
Recurrence gives incorrect values when the order of previous states is important. eg recurrence!"a[n-1] + a[n-2]"(1,2) works, but recurrence!"a[n-2]"(1,2) does not. fix: void popFront() { _state[_n % stateSize] = binaryFun!(fun, "a", "n")( - cycle(_state, _n), _n + stateSize); + cycle(_state), _n + stateSize); ++_n; } The old values array is being offset twice, remove the argument to cycle and it works perfectly.
Comment #1 by andrei — 2010-07-13T18:17:32Z