← Back to index
|
Original Bugzilla link
Bug 4402 – std.range.Zip doesn't work w/ non-lvalue ranges
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-06-28T19:27:00Z
Last change time
2010-08-15T19:55:18Z
Assigned to
nobody
Creator
dsimcha
Comments
Comment #0
by dsimcha — 2010-06-28T19:27:56Z
import std.range; /**Random access range based on an array, but w/o assignable or lvalue * elements.*/ struct ValArray { uint[] stuff; @property uint front() { return stuff[0]; } void popFront() { stuff = stuff[1..$]; } @property bool empty() { return stuff.length == 0; } @property uint back() { return stuff[$ - 1]; } void popBack() { stuff = stuff[0..$ - 1]; } uint opIndex(size_t index) { return stuff[index]; } @property typeof(this) save() { return this; } @property size_t length() { return stuff.length; } } void main() { auto stuff = ValArray([1u, 2U, 3U]); auto myZip = zip(stuff, stuff); } Error Msgs: d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(1720): Error: cannot implicitly convert expression (&this.ranges._field_field_0.front) of type uint delegate() to uint* d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(1720): Error: cannot implicitly convert expression (&this.ranges._field_field_1.front) of type uint delegate() to uint* d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(1733): Error: cannot implicitly convert expression (&this.ranges._field_field_0.back) of type uint delegate() to uint* d:\dmd2\windows\bin\..\..\src\phobos\std\range.d(1733): Error: cannot implicitly convert expression (&this.ranges._field_field_1.back) of type uint delegate() to uint* Zip should detect whether the ranges it's fed offer lvalue access and properly relay this property.
Comment #1
by dsimcha — 2010-08-15T19:55:18Z
Fixed SVN.