From 2be3e59849c67ccb8438d9f7721817af8d52f2e1 Mon Sep 17 00:00:00 2001 From: AMAN UPADHYAY Date: Sun, 5 Jul 2026 18:35:00 +0530 Subject: [PATCH] Refactor: use built-in use_format_as traits per review --- include/fmt/compile.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index a618e162..2c5a4323 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -175,6 +175,7 @@ struct compile_has_format_as : std::false_type {}; template struct compile_has_format_as()))>> : std::true_type {}; + template struct field { using char_type = Char; @@ -184,14 +185,21 @@ template struct field { if constexpr (std::is_convertible>::value) { auto s = basic_string_view(arg); return copy(s.begin(), s.end(), out); - } else if constexpr (compile_has_format_as::value) { + } else if constexpr (detail::use_format_as::value) { return write(out, format_as(arg)); + } else if constexpr (detail::use_format_as_member::value) { + return write(out, formatter::format_as(arg)); } else { return write(out, arg); } } }; + + + + + template struct is_compiled_format> : std::true_type {};