Why can't static arrays be sorted?

Ali Çehreli via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Oct 5 12:35:53 PDT 2016


On 10/05/2016 12:30 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
 > On Wednesday, October 05, 2016 19:22:03 pineapple via 
Digitalmars-d-learn
 > wrote:

 >> Would just like to point out that this is design weirdness on
 >> Phobos' part - the library I've been writing does not have this
 >> problem.
 >
 > It doesn't even make conceptual sense for a static array to be a range,
 > because you can't remove elements from it.

But algorithms like sort() need not require popFront(). I guess we need 
another range type: NonShrinkingRandomAccessRange. :)

Ali



More information about the Digitalmars-d-learn mailing list