Sort trouble

bearophile bearophileHUGS at lycos.com
Tue Apr 7 03:02:26 PDT 2009


Smaller version, one sort is enough to cause the error:

void main() {
  auto a = new uint[0x8F_FFFF]; // smallest size that fails
  a.sort;
}

I like the idea of having a built-in sort, but I think it's now better to remove it, and move it into the std lib, so:
- It can be replaced/improved/debugged in a simpler way.
- It can be more flexible (for example mine accepts an optional "key" mapping function)
- It can be a template, so it can be faster (confirmed. I have a sort that is sometimes 3+ times faster).
- The overall size and complexity of the language can be a bit lower.
- The usage syntax can be almost the same anyway: arr.sort()

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list