How to sort a range

rcorre via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 9 07:52:04 PST 2016


On Wednesday, 9 March 2016 at 14:28:11 UTC, cym13 wrote:
>
> Note that an input range isn't even remotely a container, it's 
> a way to iterate on a container. As you don't have all elements 
> at hand you can't sort them, that's why you have to use array 
> here.

Oh, I think it just clicked. I was thinking 'sort takes a range, 
so it must be used for sorting ranges', but I should have thought 
'sort takes a range so it can sort a container via a range over 
that container'.


More information about the Digitalmars-d-learn mailing list