Initializing multidimentional Array with a struct

Chris Pons cmpons at gmail.com
Sat Mar 31 14:52:24 PDT 2012


I also tried this, which gives an out of range error:

	void InitializePathGraph()
	{
		PathGraph.length = mapWidth;
		foreach( elem; PathGraph )
		{
			elem.length = mapHeight;
		}
		
		Node node;

		for( int x = 0; x < mapWidth - 1; x++ )
		{
			for( int y = 0; y < mapHeight - 1; y++ )
			{
				
				PathGraph[x][y] = node;
			}
		}
	}

This is really confusing me.


More information about the Digitalmars-d-learn mailing list