Fix implicit cast issues in PrintQueue

This commit is contained in:
Stefan Müller 2025-02-14 18:38:34 +01:00
parent 26f40147d2
commit ee60c23cfb
1 changed files with 6 additions and 6 deletions

View File

@ -80,22 +80,22 @@ size_t PrintQueue::getMapped(const int pageNo)
void PrintQueue::processOrderingRule(const std::string& line)
{
auto pos{ line.find("|") };
auto before{ std::stoi(line.substr(0, pos)) };
auto after{ std::stoi(line.substr(pos + 1)) };
size_t pos{ line.find("|") };
int before{ std::stoi(line.substr(0, pos)) };
int after{ std::stoi(line.substr(pos + 1)) };
orderingRules_[getMapped(before)][getMapped(after)] = true;
}
void PrintQueue::processUpdatePages(const std::string& line)
{
std::vector<size_t> pages{};
std::vector<int> pages{};
std::stringstream stream{ line };
std::string token;
auto isCorrectOrder{ true };
bool isCorrectOrder{ true };
// We completely construct 'pages' for part 2, even if the ordering is not correct.
while (std::getline(stream, token, ','))
{
size_t page = std::stoi(token);
int page = std::stoi(token);
size_t i{ 0 };
while (isCorrectOrder && i < pages.size())
{