sorting a BigInt[] with algorithm.sort()

Charles McAnany mcanance at rose-hulman.edu
Thu Jun 16 12:17:20 PDT 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 at 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.


More information about the Digitalmars-d-learn mailing list