Took the plunge and converted my 'shaperators' into templates so they'll work on any 'matrix-like' thing.

This commit is contained in:
Zed A. Shaw 2024-12-31 08:13:20 -05:00
parent 5adeb4e078
commit 4cb41a61db
5 changed files with 182 additions and 192 deletions

View file

@ -6,7 +6,7 @@
using std::vector;
inline void add_neighbors(PointList &neighbors, Matrix &closed, size_t y, size_t x) {
for(matrix::in_box it{closed, x, y, 1}; it.next();) {
for(matrix::box it{closed, x, y, 1}; it.next();) {
if(closed[it.y][it.x] == 0) {
closed[it.y][it.x] = 1;
neighbors.push_back({.x=it.x, .y=it.y});