Bug 1317 – Document suggested means of overlapping array copy
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2007-07-05T11:43:00Z
Last change time
2015-06-09T01:31:14Z
Keywords
pull
Assigned to
nobody
Creator
jlquinn
Comments
Comment #0 by jlquinn — 2007-07-05T11:43:30Z
The docs on arrays has a section on copying arrays using slice notation. It rules out overlapping copies. Since you can't do this, there should be a suggested method of doing that - a pointer to memcpy(), using concatenation, open-coding the loop, a Phobos library call, etc.
Related to #473.
Comment #1 by lt.infiltrator — 2014-03-18T21:11:49Z
Comment #2 by bearophile_hugs — 2014-03-19T03:45:56Z
(In reply to comment #1)
> https://github.com/D-Programming-Language/dlang.org/pull/527
The suggested method with dup+slices doesn't look very good. Don't we have something better? For PODs even core.stdc.string.memmove sounds better. Perhaps a new Phobos function is needed? Or perhaps std.algorithm.copy is enough?
Comment #3 by lt.infiltrator — 2014-03-19T04:05:31Z
Doesn't look good style-wise or performance-wise?
Comment #4 by bearophile_hugs — 2014-03-19T04:16:24Z
(In reply to comment #3)
> Doesn't look good style-wise or performance-wise?
I have not done benchmarks, but perhaps there are faster solutions.