aoc24: day05 filter invalid
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user