[Issue 2872] New: Length for Ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 21 18:01:39 PDT 2009


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

           Summary: Length for Ranges
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: enhancement
          Priority: P4
         Component: Phobos
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dsimcha at yahoo.com


Kind of a meta-enhancement, but it would be nice if all of the generic range
types in std.range and std.algorithm would try to have length properties if the
range that they're wrapping does.  For example, as far as I can tell, it
wouldn't be hard to make Map have a length property that forwards to the
underlying range's length property if it exists.

This would primarily be useful when copying generic ranges to an array, as this
can be done much more efficiently if the length is known ahead of time and the
array can be allocated exactly once, rather than appending.


-- 



More information about the Digitalmars-d-bugs mailing list