digitalmars.D.learn - sorting a BigInt[] with algorithm.sort()
- Charles McAnany <mcanance rose-hulman.edu> Jun 16 2011
- bearophile <bearophileHUGS lycos.com> Jun 16 2011
Hi, all. This is a strange one.
import std.bigint;
import std.algorithm;
void main(){
BigInt[] ar = [BigInt(2), BigInt(1), BigInt(3)];
sort(ar);
}
object.Exception src\rt\arraycat.d(40): overlapping array copy
Is this a library bug? Or is sort() not supposed to work on this data?
Oh, additionally,
bool res = ar[0] < ar[1]; compiles and executes just fine, as does the normal
swapping algorithm:
BigInt t = ar[0];
ar[0] = ar[1];
ar[1] = t;
Thanks,
Charles.
Jun 16 2011
Charles McAnany:object.Exception src\rt\arraycat.d(40): overlapping array copy Is this a library bug? Or is sort() not supposed to work on this data?
It's a known bug: http://d.puremagic.com/issues/show_bug.cgi?id=5705 (Is Bugzilla down?) Bye, bearophile
Jun 16 2011








bearophile <bearophileHUGS lycos.com>