Is there any reason why in can't work with dynamic arrays?
666total at wp.pl
Wed Sep 18 07:08:23 UTC 2019
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. Clearly
> y has to be an int and clearly the semantics are equivalent to
> AA and so it all works out rather than having an arbitrary
> special case.
> This is helpful when one has generate algorithms that can work
> with AA's or DA's that use in.
Wow! Does really in work like that with arrays? This is terrible.
I'd never expect in to check if index is in range. In every
language in existence (that I know of) that has 'in', 'in' is a
search for existence of value, whether a linear search is
required or not.
More information about the Digitalmars-d