www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4402] New: std.range.Zip doesn't work w/ non-lvalue ranges

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4402

           Summary: std.range.Zip doesn't work w/ non-lvalue ranges
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: dsimcha yahoo.com


--- Comment #0 from David Simcha <dsimcha yahoo.com> 2010-06-28 19:27:56 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 28 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4402


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


--- Comment #1 from David Simcha <dsimcha yahoo.com> 2010-08-15 19:55:18 PDT ---
Fixed SVN.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Aug 15 2010