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.
Comment #5 by nick — 2014-10-24T15:43:05Z
Comment #6 by github-bugzilla — 2014-10-25T09:05:22Z
Commits pushed to master at https://github.com/D-Programming-Language/dlang.org https://github.com/D-Programming-Language/dlang.org/commit/2387953b9a67b6d7945c87106c42c9a07ba22cce Fix Issue 1317 - Document suggested means of overlapping array copy https://github.com/D-Programming-Language/dlang.org/commit/633f65606181d1e7c821420e72d59d6806b54ecc Merge pull request #680 from ntrel/array-overlap Fix Issue 1317 - Document suggested means of overlapping array copy