From 9041bca378dbd239bf868526cbc1395111dff5fa Mon Sep 17 00:00:00 2001 From: Eric Mertens Date: Sat, 28 Dec 2024 15:24:25 -0600 Subject: [PATCH] use std::tuple --- 2024/07.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/2024/07.cpp b/2024/07.cpp index c119423..f5c7082 100644 --- a/2024/07.cpp +++ b/2024/07.cpp @@ -1,12 +1,12 @@ #include #include -#include +#include #include -#include #include #include +#include namespace qi = boost::spirit::qi; @@ -23,11 +23,15 @@ auto drop_suffix(std::uint64_t x, std::uint64_t y) -> std::optional const& numbers) -> bool +auto calibrated( + bool const part2, + std::uint64_t const target, + std::vector const& numbers +) -> bool { if (numbers.size() == 0) { return false; } - auto work = std::stack>{}; + auto work = std::stack>{}; work.emplace(numbers.size() - 1, target); while (not work.empty()) @@ -57,8 +61,8 @@ auto Main(std::istream & in, std::ostream & out) -> void { auto const input = aocpp::ParseSimple - >>> - (in, *(qi::ulong_long >> ':' >> *(' ' >> qi::ulong_long) >> '\n')); + >>> + (in, *(qi::ulong_long >> ':' >> +(' ' >> qi::ulong_long) >> '\n')); std::uint64_t p1 = 0, p2 = 0; for (auto && [x, xs] : input) {