[Issue 3894] New: std.range.Stride!R requires R.front() and R.back() to return by reference

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 8 03:58:36 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=3894

           Summary: std.range.Stride!R requires R.front() and R.back() to
                    return by reference
           Product: D
           Version: 2.041
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: bugzilla at kyllingen.net


--- Comment #0 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2010-03-08 03:58:32 PST ---
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 at 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.

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


More information about the Digitalmars-d-bugs mailing list