www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8405] New: Create overload for joiner which is random access for random access ranges


           Summary: Create overload for joiner which is random access for
                    random access ranges
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com

--- Comment #0 from Jonathan M Davis <jmdavisProg gmx.com> 2012-07-21 13:25:41
PDT ---
std.algorithm.joiner returns a lazy range which is never random access. I
believe that at least in the case where joiner doesn't take a separator, it
should be possible to make it random access as long as all of the ranges passed
in are random access and have length.

It might also be possible to do the same thing with the one that takes a
separator, but that could get a bit messier. Certainly, if you want the
elements to be properly movable (e.g. for sort), then each separator in the
range would then have to actually be a separate range as soon as the range is

But someone was asking in D.Learn why they couldn't sort a range returned by
joiner, and after some thought, I do think that we can make that possible,
though given that at this point, joiner's result doesn't really affect the
original, and it _would_ if it were sorted, so maybe this would be too big a
change, but it's certainly something to consider.

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