From 2762893579742c2f660bd4e5ef93f37cac236ed4 Mon Sep 17 00:00:00 2001 From: bigcharl <128563817+bigcharl@users.noreply.github.com> Date: Sat, 16 Sep 2023 02:08:33 -0300 Subject: [PATCH] Update tools.h tfs clas --- src/tools.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tools.h b/src/tools.h index e5d554091..3f809f4d1 100644 --- a/src/tools.h +++ b/src/tools.h @@ -96,4 +96,18 @@ int64_t OTSYS_TIME(); SpellGroup_t stringToSpellGroup(const std::string& value); -#endif // FS_TOOLS_H \ No newline at end of file +namespace tfs { + +#if __has_cpp_attribute(__cpp_lib_to_underlying) + +inline constexpr auto to_underlying(auto e) noexcept { return std::to_underlying(e); } + +#else + +inline constexpr auto to_underlying(auto e) noexcept { return static_cast>(e); } + +#endif + +} // namespace tfs + +#endif // FS_TOOLS_H