From 725cae21ebbb639f8c8a4f09749dedf940809bb0 Mon Sep 17 00:00:00 2001 From: jacekpoz Date: Thu, 25 Apr 2024 22:35:14 +0200 Subject: [PATCH] handle parsing ints to enums --- include/config.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/config.hpp b/include/config.hpp index 18ff0b5..3df4c8c 100644 --- a/include/config.hpp +++ b/include/config.hpp @@ -8,6 +8,7 @@ #endif #include +#include #include @@ -74,6 +75,11 @@ inline std::istream &operator>>(std::istream &is, name &en) {\ std::string input;\ is >> input;\ + if (isInt(input)) {\ + en = static_cast(std::stoul(input));\ + return is;\ + }\ + toUpper(input);\ FOR_EACH(ENUM_FROM_STRING, name, __VA_ARGS__)\ return is;\ }