diff --git a/include/aoc/PrintQueue.hpp b/include/aoc/PrintQueue.hpp index db1cc39..91811a7 100644 --- a/include/aoc/PrintQueue.hpp +++ b/include/aoc/PrintQueue.hpp @@ -15,6 +15,9 @@ #pragma once +#include + +#include #include class PrintQueue @@ -31,8 +34,8 @@ class PrintQueue static const int maxPageNo_{ 99 }; bool isProcessingOrderingRules_; int pageNoMapIndex_; - int pageNoMap_[maxPageNo_ + 1]; - bool orderingRules_[nPages_][nPages_]; + std::vector pageNoMap_; + Grid orderingRules_; size_t getMapped(const int pageNo); void processOrderingRule(const std::string& line); void processUpdatePages(const std::string& line); diff --git a/src/PrintQueue.cpp b/src/PrintQueue.cpp index 4968feb..75e4098 100644 --- a/src/PrintQueue.cpp +++ b/src/PrintQueue.cpp @@ -20,20 +20,10 @@ #include PrintQueue::PrintQueue() - : Solver{}, pageNoMapIndex_{ 0 }, isProcessingOrderingRules_{ true }, orderingRules_{} + : Solver{}, isProcessingOrderingRules_{ true }, pageNoMapIndex_{ 0 }, pageNoMap_(maxPageNo_ + 1, -1), + orderingRules_(nPages_, nPages_) { - for (size_t i = 0; i <= maxPageNo_; i++) - { - pageNoMap_[i] = -1; - } - - for (size_t i = 0; i < nPages_; i++) - { - for (size_t j = 0; j < nPages_; j++) - { - orderingRules_[i][j] = false; - } - } + orderingRules_.fill(false); } const std::string PrintQueue::getPuzzleName() const