[Issue 19229] formattedWrite destructively iterates over forward ranges

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Sep 6 16:29:14 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=19229

Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang at jmdavisProg.co
                   |                            |m

--- Comment #2 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
In general, if you pass a range by value, then it's copied, and you have to
assume that the original is then unusable, because the semantics of copying a
range are unspecified and can vary wildly depending on the range type. If you
want to pass a range to a function and then continue to use it (including
passing it to another function in the same expression), then you need to call
save. IMHO, there is no bug here. If you want to do anything with the range
after passing it to text, then you need to call save on it when passing it.

--


More information about the Digitalmars-d-bugs mailing list