Bug 3894 – std.range.Stride!R requires R.front() and R.back() to return by reference

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2010-03-08T03:58:00Z
Last change time
2014-02-15T02:43:01Z
Assigned to
nobody
Creator
bugzilla

Comments

Comment #0 by bugzilla — 2010-03-08T03:58:32Z
Quoting Mihail Strashun on the digitalmars.D.learn newsgroup: --- Following simple program fails to compile with latest DMD 2.041 (In fact it fails to compile with any dmd2 version i have tried): "test.d" > import std.stdio; > import std.range; > import std.algorithm; > > int main() > { > auto test = stride( iota(0,10,1) , 2 ); > return 0; > } Output: [mist@mistwork d]$ dmd -run test.d /usr/include/d/std/range.d(716): Error: this._input.front() is not an lvalue /usr/include/d/std/range.d(724): Error: this._input.back() is not an lvalue --- The problem is that Stride.front() and Stride.back() are defined to return by reference, which is not the case for all ranges.
Comment #1 by dsimcha — 2010-08-14T15:04:28Z
Fixed SVN.