www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2872] New: Length for Ranges

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: dsimcha 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.


-- 
Apr 21 2009
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2872


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Length for Ranges           |Length, opIndex for Map




--- Comment #1 from David Simcha <dsimcha yahoo.com>  2009-05-13 06:47:11 PDT
---
Now that I've played around more with the new Phobos, this is really just an
issue with map.  Also, opIndex for map seems like a reasonable proposition.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2872


Andrei Alexandrescu <andrei metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei metalanguage.com
         AssignedTo|nobody puremagic.com        |andrei metalanguage.com


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 11 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2872



--- Comment #2 from David Simcha <dsimcha yahoo.com> 2009-10-27 20:58:34 PDT ---
Created an attachment (id=482)
Revised map

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2872


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #3 from David Simcha <dsimcha yahoo.com> 2009-10-27 21:00:10 PDT ---
Here's a revised map that supports bidirectional ranges, slicing, length and
random access if the underlying range supports these.  

You may want to note in the docs, however, that random access indexing isn't
cached and therefore should only be used frequently if fun is cheap.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 27 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2872


David Simcha <dsimcha yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |philippe.sigaud gmail.com


--- Comment #4 from David Simcha <dsimcha yahoo.com> 2010-06-17 19:28:06 PDT ---
*** Issue 3871 has been marked as a duplicate of this issue. ***

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


David Simcha <dsimcha yahoo.com> changed:

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


--- Comment #5 from David Simcha <dsimcha yahoo.com> 2010-06-17 19:33:07 PDT ---
Fixed in SVN.

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