[Issue 9102] New: OutputRange should be ref parameter

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Dec 1 22:35:19 PST 2012


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

           Summary: OutputRange should be ref parameter
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: zan77137 at nifty.com


--- Comment #0 from SHOO <zan77137 at nifty.com> 2012-12-01 22:35:18 PST ---
This code doesn't work:

----------------------
import std.algorithm, std.digest.crc;
void main()
{
    CRC32 crcA, crcB;
    const ubyte[] ary3 = [1,2,3,4];
    copy(ary3, crcA);
    copy(ary3, &crcB);
    assert(crcA.finish() == crcB.finish());
}
----------------------
The second parameter of copy is non-ref OutputRange. This will be broken by
receiving OutputRange which is a non-reference type.
Like std.range.put, it is necessary to make ref parameter.
Some similar cases appear elsewhere. (eg. formattedWrite

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