RectGrid.allTiles

Get a range that iterates through every tile in the grid.

struct RectGrid(T)
allTiles
()

Examples

Use allTiles to apply range-oriented functions to the tiles in the grid.

import std.algorithm;

auto myGrid = rectGrid([
  [ 00, 01, 02, 03, 04 ],
  [ 10, 11, 12, 13, 14 ],
  [ 20, 21, 22, 23, 24 ],
]);

assert(myGrid.allTiles.filter!(x => x > 22).equal([23, 24]));

// use ref with allTiles to apply modifications
foreach(ref tile ; myGrid.allTiles.filter!(x => x < 10)) {
  tile += 10;
}

assert(myGrid.tileAt(RowCol(0,0)) == 10);

Meta