Is there any reason why in can't work with dynamic arrays?
kozzi11 at gmail.com
Wed Sep 18 08:24:17 UTC 2019
On Tue, Sep 17, 2019 at 8:15 PM Brett via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> Alternatively, have a keys for a DA:
> then one can do
> if (y in x.keys)
> and this is far more expressive so there is no confusion and also
> works with AA's(and would not result in keys having to be created
> because it is semantically the same as (y in x) if x is an AA).
No this would not work, because on AAs (keys) it will return dynamic
array and you are back with same issue.
You will need to use something with different name and write some UFCS
helper for both DA and AA, for AA it could just return itself, for DA
you can use Adam's example
More information about the Digitalmars-d