[Issue 4597] New: std.algorithm.filter fails with a const range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Aug 7 22:29:14 PDT 2010


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

           Summary: std.algorithm.filter fails with a const range
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: braddr at puremagic.com


--- Comment #0 from Brad Roberts <braddr at puremagic.com> 2010-08-07 22:29:10 PDT ---
Index: std/algorithm.d
===================================================================
--- std/algorithm.d     (revision 1807)
+++ std/algorithm.d     (working copy)
@@ -830,6 +830,9 @@

     // With chain
     assert(equal(filter!overX(chain(a, nums)), [22, 42]));
+
+    const int[] list = [ 1, 2, 10, 11, 3, 4 ];
+    assert(equal(filter!overX(list), [ 1, 2, 10, 3, 4 ]));
 }

 // move

Adding that test produces the folling failure:
std/algorithm.d(737): Error: this is not mutable

That's the opSlice function of struct Filter:
            ref Filter opSlice()
            {
                return this;
            }

-- 
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