Remove raw array use from PrintQueue
This commit is contained in:
parent
ae99d41cf4
commit
0b72b7efdc
|
@ -15,6 +15,9 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <aoc/Grid.hpp>
|
||||||
#include <aoc/Solver.hpp>
|
#include <aoc/Solver.hpp>
|
||||||
|
|
||||||
class PrintQueue
|
class PrintQueue
|
||||||
|
@ -31,8 +34,8 @@ class PrintQueue
|
||||||
static const int maxPageNo_{ 99 };
|
static const int maxPageNo_{ 99 };
|
||||||
bool isProcessingOrderingRules_;
|
bool isProcessingOrderingRules_;
|
||||||
int pageNoMapIndex_;
|
int pageNoMapIndex_;
|
||||||
int pageNoMap_[maxPageNo_ + 1];
|
std::vector<int> pageNoMap_;
|
||||||
bool orderingRules_[nPages_][nPages_];
|
Grid<bool> orderingRules_;
|
||||||
size_t getMapped(const int pageNo);
|
size_t getMapped(const int pageNo);
|
||||||
void processOrderingRule(const std::string& line);
|
void processOrderingRule(const std::string& line);
|
||||||
void processUpdatePages(const std::string& line);
|
void processUpdatePages(const std::string& line);
|
||||||
|
|
|
@ -20,20 +20,10 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
PrintQueue::PrintQueue()
|
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++)
|
orderingRules_.fill(false);
|
||||||
{
|
|
||||||
pageNoMap_[i] = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < nPages_; i++)
|
|
||||||
{
|
|
||||||
for (size_t j = 0; j < nPages_; j++)
|
|
||||||
{
|
|
||||||
orderingRules_[i][j] = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string PrintQueue::getPuzzleName() const
|
const std::string PrintQueue::getPuzzleName() const
|
||||||
|
|
Loading…
Reference in New Issue