D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4879 - std.range.ElementType does not handle output ranges; breaks std.algorithm.copy, etc.
Summary: std.range.ElementType does not handle output ranges; breaks std.algorithm.cop...
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-17 08:15 UTC by Rob Jacques
Modified: 2010-09-17 10:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Rob Jacques 2010-09-17 08:15:33 UTC
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;
}
Comment 1 Rob Jacques 2010-09-17 10:26:20 UTC
Sorry, I misread the signature of copy(), leading me to think this was important to the bug, etc. See bug 4880