June 18

I'm having difficulty figuring out exactly what signature D is expecting.

enum DIR
	{
		UP = 0,
		DOWN,
		LEFT,
		RIGHT,	
		UPLEFT,
		UPRIGHT,
		DOWNRIGHT,
		DOWNLEFT,
	}

BITMAP*[2][DIR] bmps;

// ...

bmps[DIR.UP][0] = nope.
bmps[DIR.UP][0] = new BITMAP *; // nope
bmps[DIR.UP][0] = new BITMAP; // nope
bmps[DIR.UP] = new BITMAP*[2]; // compiles. runtime range violation.

I swear this all worked fine when it was just:

bmps[DIR] bmps;
June 18
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.