multidim array with enum

Chris Katko ckatko at gmail.com
Sat Jun 18 17:19:24 UTC 2022


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

````D
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:
````D
bmps[DIR] bmps;
````



More information about the Digitalmars-d-learn mailing list