From 1c860f7e4cc0045c6c17fb9c745f1f619b55abbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Wed, 30 Apr 2025 20:45:09 +0200 Subject: [PATCH] Fix code messages --- include/aoc/ReindeerMaze.hpp | 2 +- include/aoc/extra/MullData.hpp | 8 ++++---- src/HoofIt.cpp | 6 +++--- src/ReindeerMaze.cpp | 2 +- src/extra/MullData.cpp | 8 ++++---- src/framework/SolverEngine.cpp | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/include/aoc/ReindeerMaze.hpp b/include/aoc/ReindeerMaze.hpp index 3f6220f..1e533a4 100644 --- a/include/aoc/ReindeerMaze.hpp +++ b/include/aoc/ReindeerMaze.hpp @@ -39,7 +39,7 @@ class ReindeerMaze void initializeWorkList(std::list& crossings, const int entryVertex); void addCheckedIncidence(std::vector& incidences, const Point2 start, const Point2 direction); - Point2 findStart(); + Point2 findStart() const; void AddPathSegmentEdges(WeightedEdgeGraph& graph, const ReindeerMazePathIncidence& pathIncidence, const std::vector& otherPathIncidences); }; diff --git a/include/aoc/extra/MullData.hpp b/include/aoc/extra/MullData.hpp index 4cdad06..a895716 100644 --- a/include/aoc/extra/MullData.hpp +++ b/include/aoc/extra/MullData.hpp @@ -19,13 +19,13 @@ class MullData { public: MullData(); - bool getIsEnabled(); + bool getIsEnabled() const; void setIsEnabled(const bool value); - int getFactor(const int index); + int getFactor(const int index) const; void setFactor(const int index, const int value); void updateResult(); - long long int getResultPart1(); - long long int getResultPart2(); + long long int getResultPart1() const; + long long int getResultPart2() const; private: bool isEnabled_; int factor1_; diff --git a/src/HoofIt.cpp b/src/HoofIt.cpp index 5c2bc3f..ea74849 100644 --- a/src/HoofIt.cpp +++ b/src/HoofIt.cpp @@ -55,11 +55,11 @@ void HoofIt::finish() while (!queue.empty()) { - auto trail = queue.front(); + const auto& trail = queue.front(); queue.pop(); if (getCharAt(trail) != getTrailheadChar()) { - for (auto direction : Point2::cardinalDirections) + for (const auto& direction : Point2::cardinalDirections) { Point2 p{ trail + direction }; if (isInBounds(p) && getCharAt(p) + 1 == getCharAt(trail)) @@ -93,7 +93,7 @@ constexpr char HoofIt::getTrailTopChar() void HoofIt::addUnique(const std::vector& source, std::vector& destination) { - for (auto end : source) + for (const auto& end : source) { auto isUnique{ true }; size_t i{ 0 }; diff --git a/src/ReindeerMaze.cpp b/src/ReindeerMaze.cpp index 8347373..de2aeb5 100644 --- a/src/ReindeerMaze.cpp +++ b/src/ReindeerMaze.cpp @@ -224,7 +224,7 @@ void ReindeerMaze::addCheckedIncidence(std::vector& i } } -Point2 ReindeerMaze::findStart() +Point2 ReindeerMaze::findStart() const { for (int j = 0; j < lines.size(); j++) { diff --git a/src/extra/MullData.cpp b/src/extra/MullData.cpp index b95bb2a..1702927 100644 --- a/src/extra/MullData.cpp +++ b/src/extra/MullData.cpp @@ -20,7 +20,7 @@ MullData::MullData() { }; -bool MullData::getIsEnabled() +bool MullData::getIsEnabled() const { return isEnabled_; } @@ -30,7 +30,7 @@ void MullData::setIsEnabled(const bool value) isEnabled_ = value; } -int MullData::getFactor(const int index) +int MullData::getFactor(const int index) const { return index == 1 ? factor1_ : factor2_; } @@ -57,12 +57,12 @@ void MullData::updateResult() } } -long long int MullData::getResultPart1() +long long int MullData::getResultPart1() const { return part1_; } -long long int MullData::getResultPart2() +long long int MullData::getResultPart2() const { return part2_; } diff --git a/src/framework/SolverEngine.cpp b/src/framework/SolverEngine.cpp index 0447758..61623a6 100644 --- a/src/framework/SolverEngine.cpp +++ b/src/framework/SolverEngine.cpp @@ -46,7 +46,7 @@ void SolverEngine::run(Solver& solver) std::filesystem::path SolverEngine::tryGetValidFullInputFilePath(const std::string& inputFileName) { - for (auto path : inputPaths_) + for (const auto& path : inputPaths_) { std::filesystem::path fullFilePath = path; fullFilePath /= inputFileName;