Why 'in' works only for assoc arrays?
JN
666total at wp.pl
Fri Dec 27 19:17:13 UTC 2024
Why not make 'in' work for arrays (and strings also)?
```
int[string] phonebook;
if ("John" in phonebook) // works
int[] numbers;
if (3 in numbers) // doesn't work, compiler recommends
std.algorithm.find
string buildLog;
if ("build error" in buildLog) // doesn't work, compiler
recommends std.algorithm.find
```
Good thing that compiler recommends what to use instead, but why
not just make it work for any container?
More information about the Digitalmars-d-learn
mailing list