Bug 4879 – std.range.ElementType does not handle output ranges; breaks std.algorithm.copy, etc.
Status
RESOLVED
Resolution
INVALID
Severity
regression
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-09-17T08:15:00Z
Last change time
2010-09-17T10:26:20Z
Assigned to
nobody
Creator
sandford
Comments
Comment #0 by sandford — 2010-09-17T08:15:33Z
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 by sandford — 2010-09-17T10:26:20Z
Sorry, I misread the signature of copy(), leading me to think this was important to the bug, etc. See bug 4880