```D
class bitmapHandler
{
bitmap*[string] bmps;

void get(string name){return bmps[name]; /* plus other code */}
}

void usage()
{
bitmapHandler bh;
bitmap foo = bh.get("bar");  // works
bitmap foo2 = bh["bar"]; // desired
}
```

Should I be using opEquals? Or something different? The problem with 'alias this' here is I want to wrap access to the insides with getter functions that do various things like logging and error checking.

I mean, if I ruined some encapsulation, I could make a function called "bh" and have the usage:
```D
bh("bar");
```
and have it access a singleton object.

  • 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