This commit is contained in:
2022-11-12 17:16:28 -08:00
parent 5b21e37772
commit 40c6998e05
3 changed files with 238 additions and 1 deletions

View File

@@ -13,6 +13,14 @@ namespace aocpp {
struct Grid {
std::vector<std::string> rows;
auto contains(Coord c) const -> bool {
return
0 <= c.x
&& 0 <= c.y
&& c.y < rows.size()
&& c.x < rows[c.y].size();
}
auto operator[](Coord c) -> char& { return rows[c.y][c.x]; }
auto operator[](Coord c) const -> char { return rows[c.y][c.x]; }
@@ -40,4 +48,4 @@ struct Grid {
}
#endif
#endif