rectGrid

Convenience function to wrap a RectGrid around a 2D array.

rectGrid
(
T
)
()
if (
isArray2D!T
)

Examples

1 auto dynamicArray = [
2   [1,2,3],
3   [4,5,6]
4 ];
5 auto dynamicGrid = rectGrid(dynamicArray);
6 assert(dynamicGrid.numRows == 2 && dynamicGrid.numCols == 3);
7 static assert(is(dynamicGrid.TileType == int));
8 
9 char[3][2] staticArray = [
10   [ 'a', 'a', 'a' ],
11   [ 'a', 'a', 'a' ],
12 ];
13 auto staticGrid = rectGrid(staticArray);
14 assert(staticGrid.numRows == 2 && staticGrid.numCols == 3);
15 static assert(is(staticGrid.TileType == char));

Meta