On Monday, 4 March 2024 at 23:49:46 UTC, Lettever wrote:
[ ... ]

```d
// A template constraint is added to ensure we may always index into `keys`,
// in addition to being a sanity check.
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 contains(map[keys[0]], keys[1 .. $]);
}
```

One might also be interested in adding a static assert or template constraint ensuring the number of keys passed are less than or equal to the nested-ness of the associated array.

Reply via email to