[Issue 11779] New: pointer to slice is not an input range

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 19 13:25:39 PST 2013


https://d.puremagic.com/issues/show_bug.cgi?id=11779

           Summary: pointer to slice is not an input range
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2013-12-19 13:25:38 PST ---
As a rule thumb, when the type "S" is an input range, than so is "S*". Indeed,
all of "S's primitives" can also be called using a pointer, EG:
S* p;
p.popFront(); //OK!

This works for *all* input ranges... except for slices. This is because the
"slice range primitives" are actually non-member functions:
int[]* p;
p.popFront(); //DERP!
Error: template std.array.popFront does not match any function template
declaration

I think, to be consistent with the "emulate a member primitive", that the range
functions in std.array should also work on pointer to slice.

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


More information about the Digitalmars-d-bugs mailing list