Skip to content

Commit

Permalink
Replaced STL Map with STL Set.
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyBUK committed Apr 16, 2022
1 parent 23b6522 commit 456f949
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions 2015/Day03/cpp/solver.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <set>

struct positionType
{
Expand All @@ -25,11 +25,11 @@ int main(int argc, char** argv)
kFile.open("../input.txt");
if (kFile.is_open())
{
std::map<positionType, bool> kPositions;
positionType kPosition = {0,0};
std::map<positionType, bool> kCombinedPositions;
positionType kCombinedPosition[2] = {{0,0},{0,0}};
int nCurrent = 0;
std::set<positionType> kPositions;
positionType kPosition = {0,0};
std::set<positionType> kCombinedPositions;
positionType kCombinedPosition[2] = {{0,0},{0,0}};
int nCurrent = 0;

while (!kFile.eof())
{
Expand All @@ -55,8 +55,8 @@ int main(int argc, char** argv)
kPosition.Y -= 1;
}

kPositions.insert (std::pair<positionType, bool>(kPosition, true));
kCombinedPositions.insert(std::pair<positionType, bool>(kCombinedPosition[nCurrent], true));
kPositions.insert (kPosition);
kCombinedPositions.insert(kCombinedPosition[nCurrent]);
nCurrent = 1 - nCurrent;
}

Expand Down

0 comments on commit 456f949

Please sign in to comment.