diff --git a/2022/13.cpp b/2022/13.cpp index cde1d71..5f4499e 100644 --- a/2022/13.cpp +++ b/2022/13.cpp @@ -1,21 +1,19 @@ #include #include #include -#include #include -#include -#include #include +#include + +#include +#include +#include #include #include #include -#include -#include -#include - namespace { namespace phx = boost::phoenix; @@ -29,7 +27,6 @@ struct Tree { std::variant rep; }; - auto operator<(Tree const& x, std::int64_t y) -> bool; auto operator<(std::int64_t x, Tree const& y) -> bool; @@ -98,8 +95,8 @@ auto Parse(std::istream & in) -> Input auto Part1(Input const& input) -> std::size_t { std::int64_t result {0}; - for (auto const i : boost::irange(input.size())) { - if (input[i][0] < input[i][1]) { + for (auto const& [i,pair] : boost::adaptors::index(input)) { + if (pair[0] < pair[1]) { result += i + 1; } }