multidim array with enum

Adam D Ruppe destructionator at gmail.com
Sat Jun 18 17:50:22 UTC 2022


On Saturday, 18 June 2022 at 17:19:24 UTC, Chris Katko wrote:
> I'm having difficulty figuring out exactly what signature D is 
> expecting.
>
> BITMAP*[2][DIR] bmps;

I'm actually not sure if that [DIR] is an associative array or 
DIR's base type or a static array of DIR's size.

I *think* it is an assoc array... let's test it using the `in` 
operator:

         auto a = DIR.UP in bmps;

That compiled. So this must be an associative array!


Try this instead:

BITMAP*[2][DIR.max] bmps;


That's a static array of directions and I think that's what you 
intended and the other things should work as you want too with 
this.


More information about the Digitalmars-d-learn mailing list