On 4/12/23 04:35, Salih Dincer wrote:

> I made a little mistake and I'll fix it before someone rub nose in it :)

You asked for it! :)

>    auto opIndex(string key) {
>      if(auto ret = key in data)
>      {
>        return *ret;
>      }
>      return null;
>    }

Not every type is null'able but nullable. ;) So, a design may use the following:

  https://dlang.org/library/std/typecons/nullable.html

Ali

  • Assocative array... Chris Katko via Digitalmars-d-learn
    • Re: Assocat... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
    • Re: Assocat... Salih Dincer via Digitalmars-d-learn
      • Re: Ass... Salih Dincer via Digitalmars-d-learn
        • Re:... Ali Çehreli via Digitalmars-d-learn
          • ... Salih Dincer via Digitalmars-d-learn

Reply via email to