randomAccessRange.sort() vs randomAccessRange.array.sort()

bearophile bearophileHUGS at lycos.com
Mon Mar 4 16:10:12 PST 2013


deed:

> Meaning sortable ranges are actually a narrow subset of random 
> access ranges?

The result of a map() is more like an immutable (lazy) array. A 
const array is a random access range, but you can't mutate it. To 
sort it you need a mutable random access range :-)


> Why aren't the constraints listed in the docs?

Maybe because the docs are never finished and never perfect. If 
you think the docs are not good enough then ask for an 
improvement in bugzilla, or write a very simple documentation 
patch.


> Are the source files and error messages the only way to get 
> this info?

I think making the result of a map back-mutable doesn't have a 
lot of sense.


> Example of error message where source has to be investigated:

If you think you have interesting comments about the bugzilla 
issue, then it's better to write them in bugzilla.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list