aoc24: day05 filter invalid

This commit is contained in:
2024-12-09 15:16:11 +01:00
parent ec9028c5f5
commit c175b4ebc4
2 changed files with 104 additions and 43 deletions

View File

@@ -1,5 +1,6 @@
#include <span>
#include <expected>
#include <string>
#include "aoc.hpp"
#include "ctre.hpp"
@@ -11,7 +12,7 @@ auto entry([[maybe_unused]]std::span<char const*> const& args) -> std::expected<
u32 day = 1;
if (args.size() > 1) {
if (ctre::match<"^[0-9]+$">(args[1]))
day = std::stoul(args[1]);
day = u32(std::stoul(args[1]));
else
fmt::print(stderr, "arg: {} is not a number\n", args[1]);
}