in not working for arrays is silly, change my view

Andrea Fontana nospam at example.com
Mon Mar 2 11:52:41 UTC 2020


On Saturday, 29 February 2020 at 20:11:24 UTC, Steven 
Schveighoffer wrote:
> 1. in is supposed to be O(lg(n)) or better. Generic code may 
> depend on this property. Searching an array is O(n).

Probably it should work if we're using a "SortedRange".


int[] a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
auto p = assumeSorted(a);

assert(3 in p);




More information about the Digitalmars-d-learn mailing list