From 27f0a0292803ba109a75e4e3c30d9b1eaaec7980 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Wed, 17 Jul 2024 10:28:00 +0200 Subject: Use std::underlying_type Since according to the comment, TMWA already depended on GCC 4.7. --- src/generic/enum.hpp | 14 +------------- src/io/extract.hpp | 4 +--- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/generic/enum.hpp b/src/generic/enum.hpp index d5d50ea..07605fb 100644 --- a/src/generic/enum.hpp +++ b/src/generic/enum.hpp @@ -72,19 +72,7 @@ public: } }; -// std::underlying_type isn't supported until gcc 4.7 -// this is a poor man's emulation -// TODO I'm depending on GCC 4.7 now, this can go away -template -struct underlying_type -{ - static_assert(std::is_enum::value, "Only enums have underlying type!"); - typedef typename std::conditional< - std::is_signed::value, - typename std::make_signed::type, - typename std::make_unsigned::type - >::type type; -}; +using std::underlying_type; template::value> struct remove_enum diff --git a/src/io/extract.hpp b/src/io/extract.hpp index 897f50e..3eecf3c 100644 --- a/src/io/extract.hpp +++ b/src/io/extract.hpp @@ -33,8 +33,6 @@ #include "../compat/time_t.hpp" -#include "../generic/enum.hpp" - namespace tmwa { @@ -83,7 +81,7 @@ bool impl_extract(XString str, TimeT *tv) template::value>::type> bool extract_as_int(XString str, T *iv) { - typedef typename underlying_type::type U; + typedef typename std::underlying_type::type U; U v; // defer to integer version if (!extract(str, &v)) -- cgit v1.2.3-70-g09d2