use std::tuple
This commit is contained in:
parent
35e84c20bb
commit
9041bca378
16
2024/07.cpp
16
2024/07.cpp
@ -1,12 +1,12 @@
|
||||
#include <aocpp/Parsing.hpp>
|
||||
#include <aocpp/Startup.hpp>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/fusion/adapted/std_tuple.hpp>
|
||||
#include <boost/spirit/include/qi.hpp>
|
||||
#include <boost/fusion/include/boost_tuple.hpp>
|
||||
|
||||
#include <optional>
|
||||
#include <stack>
|
||||
#include <tuple>
|
||||
|
||||
namespace qi = boost::spirit::qi;
|
||||
|
||||
@ -23,11 +23,15 @@ auto drop_suffix(std::uint64_t x, std::uint64_t y) -> std::optional<std::uint64_
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
auto calibrated(bool const part2, std::uint64_t const target, std::vector<std::uint64_t> const& numbers) -> bool
|
||||
auto calibrated(
|
||||
bool const part2,
|
||||
std::uint64_t const target,
|
||||
std::vector<std::uint64_t> const& numbers
|
||||
) -> bool
|
||||
{
|
||||
if (numbers.size() == 0) { return false; }
|
||||
|
||||
auto work = std::stack<boost::tuple<std::size_t, std::uint64_t>>{};
|
||||
auto work = std::stack<std::tuple<std::size_t, std::uint64_t>>{};
|
||||
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
|
||||
<std::vector<boost::tuple<std::uint64_t, std::vector<std::uint64_t>>>>
|
||||
(in, *(qi::ulong_long >> ':' >> *(' ' >> qi::ulong_long) >> '\n'));
|
||||
<std::vector<std::tuple<std::uint64_t, std::vector<std::uint64_t>>>>
|
||||
(in, *(qi::ulong_long >> ':' >> +(' ' >> qi::ulong_long) >> '\n'));
|
||||
|
||||
std::uint64_t p1 = 0, p2 = 0;
|
||||
for (auto && [x, xs] : input) {
|
||||
|
Loading…
Reference in New Issue
Block a user