R.filter!(..).sort!(..)

Adam D. Ruppe destructionator at gmail.com
Tue Nov 28 13:23:25 UTC 2017


On Tuesday, 28 November 2017 at 13:10:15 UTC, Arjan wrote:
> Iaw is the compiler error msg wrong? Or i'm I wrong?

filter isn't random access because it doesn't even know how many 
elements are in there, much less where they are, until it loops 
through and does the comparisons to know which items pass the 
filter.

The .array call will buffer it and also evaluate how many items 
are actually still there after the filter, and sort uses that 
buffer too.


More information about the Digitalmars-d-learn mailing list