std.array transition question + bug question
safety0ff via Digitalmars-d
digitalmars-d at puremagic.com
Tue Jun 10 23:40:23 PDT 2014
Hello,
I was replacing some nasty slice code with std.array calls when I
encountered the following situation:
void main()
{ import std.array, std.stdio;
int[2][] arr = [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5,
0], [6, 0]];
size_t from = 4; // from is inclusive
size_t to = 6; // to is exclusive
int[2][] stuff = [[0, 0], [1, 0]]; // data in arr & stuff is
irrelevant
replaceInPlace(arr,from,to,stuff); // object.Error:
overlapping array copy
writeln(arr); // http://dpaste.dzfl.pl/40de0689e747
}
When 'from' and 'to' differ by one, there's no error, when two or
greater, error.
I believe it is a bug, but want confirmation.
When I took a peek at std.array code on github I found:
https://github.com/D-Programming-Language/phobos/blob/master/std/array.d#L1921
and:
https://github.com/D-Programming-Language/phobos/blob/master/std/array.d#L2076
I was wondering what was the status on this transition.
The code has been commented out in there for over 3 years.
Thanks!
P.S. I'd normally post this to D.learn, but I thought the
question about the commented out code warranted a bump to D main
newsgroup.
More information about the Digitalmars-d
mailing list