[Issue 15798] std.algorithm.mutation.copy takes target by value
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Sun Mar 20 23:40:47 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=15798
Ender KaShae <astrothayne at gmail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |astrothayne at gmail.com
--- Comment #1 from Ender KaShae <astrothayne at gmail.com> ---
Simply changing the Target to a ref wouldn't be backward compatible, because
then it wouldn't be possible to use an rvalue as a target, which is useful for
copying to an array slice, or using a range that wraps another output range,
such as retro. 
Also, std.range.put _does_ take a reference, and can be used to copy a range.
Alternatively, copy returns the state of the output range after copying, so in
the MD5 example you could use `s.copy(d2).finish().toHexString` to get the
correct MD5 sum.
--
    
    
More information about the Digitalmars-d-bugs
mailing list