From 664ee62c12570948b0e025d15b42d641fba8d54a Mon Sep 17 00:00:00 2001 From: Atanov Mikhail Date: Mon, 8 Jul 2024 21:37:57 +0400 Subject: [PATCH] Parameterize formatter::format to use with FMT_COMPILE (#365) --- include/magic_enum/magic_enum_format.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/magic_enum/magic_enum_format.hpp b/include/magic_enum/magic_enum_format.hpp index ded1cdf60..e25f15276 100644 --- a/include/magic_enum/magic_enum_format.hpp +++ b/include/magic_enum/magic_enum_format.hpp @@ -56,7 +56,8 @@ namespace magic_enum::customize { template struct std::formatter> && magic_enum::customize::enum_format_enabled(), char>> : std::formatter { - auto format(E e, format_context& ctx) const { + template + auto format(E e, FormatContext& ctx) const { static_assert(std::is_same_v, "formatter requires string_view::value_type type same as char."); using D = std::decay_t; @@ -83,7 +84,8 @@ struct std::formatter> && mag template struct fmt::formatter> && magic_enum::customize::enum_format_enabled(), char>> : fmt::formatter { - auto format(E e, format_context& ctx) const { + template + auto format(E e, FormatContext& ctx) const { static_assert(std::is_same_v, "formatter requires string_view::value_type type same as char."); using D = std::decay_t;