aoc24: day02b complete

This commit is contained in:
2024-12-08 22:35:49 +01:00
parent 5c692fe727
commit a1d5d359f2
14 changed files with 342 additions and 148 deletions

34
sol/24/aoc.cpp Normal file
View File

@@ -0,0 +1,34 @@
#include <span>
#include <expected>
#include "aoc.hpp"
#include "ctre.hpp"
namespace aoc24 {
auto entry([[maybe_unused]]std::span<char const*> const& args) -> std::expected<void, aoc::error> {
using namespace aoc::types;
u32 day = 1;
if (args.size() > 1) {
if (ctre::match<"^[0-9]+$">(args[1]))
day = std::stoul(args[1]);
else
fmt::print(stderr, "arg: {} is not a number\n", args[1]);
}
switch (day) {
case 1: return day01(args);
case 2: return day02(args);
case 3: return day03(args);
case 4: return day04(args);
case 5: return day05(args);
case 6: return day06(args);
case 7: return day07(args);
case 8: return day08(args);
default:
return aoc::make_error(fmt::format("day {}", day), std::errc::not_supported);
}
return {};
}
}