Finding position of a value in an array

Daren Scot Wilson darenw at
Tue Dec 31 23:12:07 UTC 2019

On Tuesday, 31 December 2019 at 06:01:36 UTC, Paul Backus wrote:

> countUntil operates on ranges, and static arrays aren't ranges. 
> To get a range from a static array, you have to slice it with 
> the `[]` operator:
>     int i = info.doos[].countUntil(important_d);
> (Why can't static arrays be ranges? Because ranges can shrink, 
> via popFront, but a static array can never change its length.)

Aha, adding [] made the compiler happy.

More information about the Digitalmars-d-learn mailing list