RectGrid.allCoords

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

struct RectGrid(T)
allCoords
()

Examples

Use allCoords to apply range-oriented functions to the coords in the grid.

import std.algorithm;

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

auto coords = myGrid.allCoords
  .filter!(x => x.col > 3)
  .map!(x => x.row * 10 + x.col);

assert(coords.equal([04, 14, 24]));

Meta