From ae99d41cf4214e44bff48367bc12d0da215668f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Tue, 21 Jan 2025 14:00:38 +0100 Subject: [PATCH] Add Grid::fill() --- include/aoc/Grid.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/aoc/Grid.hpp b/include/aoc/Grid.hpp index 596f142..4fdd381 100644 --- a/include/aoc/Grid.hpp +++ b/include/aoc/Grid.hpp @@ -53,6 +53,14 @@ class Grid { return rowNo * nColumns_ + data_.get(); } + + void fill(const T value) + { + for (size_t i = 0; i < nRows_ * nColumns_; i++) + { + data_[i] = value; + } + } private: size_t nRows_; size_t nColumns_;