[Issue 4879] New: std.range.ElementType does not handle output ranges; breaks std.algorithm.copy, etc.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Sep 17 08:16:07 PDT 2010


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

           Summary: std.range.ElementType does not handle output ranges;
                    breaks std.algorithm.copy, etc.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: sandford at jhu.edu


--- Comment #0 from Rob Jacques <sandford at jhu.edu> 2010-09-17 08:15:33 PDT ---
As of 2.049 ElementType is defined as follows:

template ElementType2(R)
{
    //alias typeof({ R r; return front(r[]); }()) ElementType;
    static if (is(typeof({return R.init.front();}()) T))
        alias T ElementType;
    else
        alias void ElementType;
}

However, the only function required of output ranges is: put(r, e)

Here is a simple test case using std.algorithm.copy and std.range.appender

import std.range;
import std.algorithm;

void main(string[] args) {
    string  str;
    copy("hello world",appender(&str));
    return;
}

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