Testing membership in associative array

Profunctor profunctor at example.com
Tue Mar 5 04:56:20 UTC 2024


My sincerest apologies, my initial solution is flawed due to a 
foolish oversight. The below version works.

```d
bool contains(M, K...)(M map, K keys)
if (K.length > 0) {
   static if (K.length == 1)
     return (keys[0] in map) !is null;
   else
     return (keys[0] in map) !is null && contains(map[keys[0]], 
keys[1 .. $]);
}
```




More information about the Digitalmars-d-learn mailing list