enums.hpp unordered_map type_traits magic_enum/magic_enum_all.hpp src/include/serif/backend/mfem/mapping/status.hpp src/include/serif/discretization/functional_space/space.hpp src/include/serif/utils/dependencies/preparation.hpp src/include/serif/utils/error/codes.hpp serif serif::meta #pragmaonce #include<unordered_map> #include<type_traits> #include"magic_enum/magic_enum_all.hpp" namespaceserif::meta{ template<typenameEnumType> [[nodiscard]]constexprstd::unordered_map<std::string_view,EnumType>enum_to_string_enum_map()noexcept{ static_assert(std::is_enum_v<EnumType>,"EnumTypemustbeanenumtype"); std::unordered_map<std::string_view,EnumType>map; for(constauto&[value,name]:magic_enum::enum_entries<EnumType>()){ map.emplace(name,value); } returnmap; } template<typenameEnumType> [[nodiscard]]constexprstd::unordered_map<EnumType,std::string_view>enum_to_enum_string_map()noexcept{ static_assert(std::is_enum_v<EnumType>,"EnumTypemustbeanenumtype"); std::unordered_map<EnumType,std::string_view>map; for(constauto&[value,name]:magic_enum::enum_entries<EnumType>()){ map.emplace(value,name); } returnmap; } }