www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: sandford jhu.edu


--- Comment #0 from Rob Jacques <sandford 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: -------
Sep 17 2010
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4879


Rob Jacques <sandford jhu.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #1 from Rob Jacques <sandford jhu.edu> 2010-09-17 10:26:20 PDT ---
Sorry, I misread the signature of copy(), leading me to think this was
important to the bug, etc. See bug 4880

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