Is there any reason why in can't work with dynamic arrays?

Vladimir Panteleev thecybershadow.lists at
Tue Sep 17 18:12:21 UTC 2019

On Tuesday, 17 September 2019 at 17:46:09 UTC, Adam D. Ruppe 
> On Tuesday, 17 September 2019 at 17:43:39 UTC, Brett wrote:
>> T[] x;
>> if (y in x) ...
>> It just checks to see if y is in between 0 and length.
> Most people asking for this want it to check that the *value* y 
> is in the array x, which is rejected for requiring a linear 
> search.
> But your idea could be done quickly, just I expect it would 
> cause confusion with the people asking for the other.

It would definitely be very confusing to Python users, where "x 
in [a, b, c]" does check if the value is in the list using a 
linear search.

More information about the Digitalmars-d mailing list