From 503dff93eccaa5fcb579a0eb1390cf5d9c307da4 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 16 Sep 2024 20:15:54 -0700 Subject: [PATCH] Simplify has_formatter --- include/fmt/base.h | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index 16dc37ad..0456e334 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -1107,11 +1107,9 @@ struct use_formatter !has_to_string_view::value && !is_named_arg::value && !use_format_as::value> {}; -template -auto has_formatter_impl(T* p) - -> decltype(formatter, Char>().format( - *p, std::declval&>()), - std::true_type()); +template > +auto has_formatter_impl(T* p, buffered_context* ctx = nullptr) + -> decltype(formatter().format(*p, *ctx), std::true_type()); template auto has_formatter_impl(...) -> std::false_type; // T can be const-qualified to check if it is const-formattable. template constexpr auto has_formatter() -> bool {