Fix inconsistent string stream naming

This commit is contained in:
Stefan Müller 2025-02-18 15:01:43 +01:00
parent bd5df5d019
commit e6a132521b
5 changed files with 12 additions and 12 deletions

View File

@ -32,7 +32,7 @@ const int BridgeRepair::getPuzzleDay() const
void BridgeRepair::processDataLine(const std::string& line) void BridgeRepair::processDataLine(const std::string& line)
{ {
std::istringstream stringStream{ line }; std::istringstream stream{ line };
long long int testValue; long long int testValue;
char colon; char colon;
@ -41,8 +41,8 @@ void BridgeRepair::processDataLine(const std::string& line)
// The precomputed numbers are used to facilitate the "concatenate" operator. // The precomputed numbers are used to facilitate the "concatenate" operator.
std::vector<std::pair<int, int>> calibrationNumbers{}; std::vector<std::pair<int, int>> calibrationNumbers{};
stringStream >> testValue >> colon; stream >> testValue >> colon;
while (stringStream >> calibrationNumber) while (stream >> calibrationNumber)
{ {
// Skips the precomputation for the first calibration numbers. // Skips the precomputation for the first calibration numbers.
int pow10{ 0 }; int pow10{ 0 };

View File

@ -36,9 +36,9 @@ void PlutonianPebbles::processDataLine(const std::string& line)
std::shared_ptr<std::map<long long int, long long int>> nextBlinkPebbles; std::shared_ptr<std::map<long long int, long long int>> nextBlinkPebbles;
// Adds initial pebbles numbers. // Adds initial pebbles numbers.
std::istringstream lineStream{ line }; std::istringstream stream{ line };
long long int pebbleNumber; long long int pebbleNumber;
while (lineStream >> pebbleNumber) while (stream >> pebbleNumber)
{ {
addPebble(*currentPebbles, pebbleNumber, 1); addPebble(*currentPebbles, pebbleNumber, 1);
} }

View File

@ -89,7 +89,7 @@ void PrintQueue::processOrderingRule(const std::string& line)
void PrintQueue::processUpdatePages(const std::string& line) void PrintQueue::processUpdatePages(const std::string& line)
{ {
std::vector<int> pages{}; std::vector<int> pages{};
std::stringstream stream{ line }; std::istringstream stream{ line };
std::string token; std::string token;
bool isCorrectOrder{ true }; bool isCorrectOrder{ true };
// We completely construct 'pages' for part 2, even if the ordering is not correct. // We completely construct 'pages' for part 2, even if the ordering is not correct.

View File

@ -35,7 +35,7 @@ void RedNosedReports::processDataLine(const std::string& line)
{ {
RedNosedReportData data{}; RedNosedReportData data{};
std::stringstream stream{ line }; std::istringstream stream{ line };
std::string token; std::string token;
std::getline(stream, token, ' '); std::getline(stream, token, ' ');
data.levels.push_back(std::stoi(token)); data.levels.push_back(std::stoi(token));

View File

@ -24,14 +24,14 @@ Solver::Solver(const int inputFileNameSuffix)
const std::string Solver::getInputFileName() const const std::string Solver::getInputFileName() const
{ {
std::ostringstream oss; std::ostringstream stream;
oss << clean(getPuzzleName()); stream << clean(getPuzzleName());
if (inputFileNameSuffix_ > 0) if (inputFileNameSuffix_ > 0)
{ {
oss << "_" << inputFileNameSuffix_; stream << "_" << inputFileNameSuffix_;
} }
oss << ".txt"; stream << ".txt";
return oss.str(); return stream.str();
} }
long long int Solver::getResultPart1() const long long int Solver::getResultPart1() const