June 16, 2011 sorting a BigInt[] with algorithm.sort() | ||||
|---|---|---|---|---|
| ||||
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.
| ||||
June 16, 2011 Re: sorting a BigInt[] with algorithm.sort() | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Charles McAnany | 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 | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply