Skip to content

Commit

Permalink
2024: fix includes with IWYU
Browse files Browse the repository at this point in the history
  • Loading branch information
yut23 committed Jan 4, 2025
1 parent 3ab365b commit bdbf8a4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 0 additions & 3 deletions 2024/src/day22.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@
#ifndef DAY22_HPP_A3Y597BB
#define DAY22_HPP_A3Y597BB

#include <iostream> // for istream
#include <string> // for string, getline

namespace aoc::day22 {

void xorshift(long &secret, int shift) {
Expand Down
5 changes: 4 additions & 1 deletion 2024/src/day23.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ int main(int argc, char **argv) {

auto graph = aoc::day23::ComputerGraph::read(infile);

// part 1 ends up clearing the graph, so do part 2 first
const auto password_parts = graph.find_password();
// this modifies the graph, so do it second

// part 1
std::cout << graph.count_t_triangles() << "\n";

// output the password for part 2
for (auto it = password_parts.begin(); it != password_parts.end(); ++it) {
if (it != password_parts.begin()) {
std::cout << ",";
Expand Down
5 changes: 4 additions & 1 deletion 2024/src/day23.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

#include "lib.hpp" // for DEBUG
#include <algorithm> // for ranges::sort
#include <compare> // for operator<(string, string)
#include <functional> // for greater
#include <iostream> // for istream, cerr
#include <string> // for string
#include <unordered_map> // for unordered_map
#include <unordered_set> // for unordered_set
#include <utility> // for move, pair
#include <vector> // for vector

namespace aoc::day23 {
Expand Down Expand Up @@ -133,7 +136,7 @@ std::vector<std::string> ComputerGraph::find_password() const {

std::vector<std::string> password_parts(maximum_clique.begin(),
maximum_clique.end());
std::sort(password_parts.begin(), password_parts.end());
std::ranges::sort(password_parts);
return password_parts;
}

Expand Down
2 changes: 2 additions & 0 deletions 2024/src/day24.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@

#include <cassert> // for assert
#include <cstddef> // for size_t
#include <functional> // for hash (unordered_map, unordered_set)
#include <iostream> // for istream
#include <string> // for string, getline, to_string
#include <unordered_map> // for unordered_map
#include <unordered_set> // for unordered_set
#include <utility> // for move
#include <vector> // for vector

namespace aoc::day24 {

Expand Down

0 comments on commit bdbf8a4

Please sign in to comment.