From 4f39d88650314bdfe7968bd3d4d082a6ddb085b9 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 1 Sep 2024 18:24:24 -0700 Subject: [PATCH] Cleanup base API --- include/fmt/base.h | 15 +++++---------- include/fmt/format.h | 4 ++++ include/fmt/printf.h | 4 ++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/fmt/base.h b/include/fmt/base.h index e37b80c7..f9908941 100644 --- a/include/fmt/base.h +++ b/include/fmt/base.h @@ -657,7 +657,6 @@ using buffered_context = conditional_t::value, context, generic_context, Char>>; -template struct arg_mapper; FMT_EXPORT template class basic_format_arg; FMT_EXPORT template class basic_format_args; FMT_EXPORT template class dynamic_format_arg_store; @@ -694,6 +693,11 @@ struct has_to_string_view< T, void_t()))>> : std::true_type {}; +/// String's character (code unit) type. detail:: is intentional to prevent ADL. +template ()))> +using char_t = typename V::value_type; + template using unsigned_char = typename conditional_t::value, std::make_unsigned, @@ -825,11 +829,6 @@ FMT_DEPRECATED FMT_NORETURN inline void throw_format_error( report_error(message); } -/// String's character (code unit) type. -template ()))> -using char_t = typename V::value_type; - enum class presentation_type : unsigned char { // Common specifiers: none = 0, @@ -2098,10 +2097,6 @@ template struct format_as_result { }; template using format_as_t = typename format_as_result::type; -template -struct has_format_as - : bool_constant, void>::value> {}; - #define FMT_MAP_API static FMT_CONSTEXPR FMT_ALWAYS_INLINE // Maps formatting arguments to reduce the set of types we need to work with. diff --git a/include/fmt/format.h b/include/fmt/format.h index a750c9f6..ec94d55b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -3820,6 +3820,10 @@ FMT_API void format_error_code(buffer& out, int error_code, using fmt::report_error; FMT_API void report_error(format_func func, int error_code, const char* message) noexcept; + +template +struct has_format_as + : bool_constant, void>::value> {}; } // namespace detail FMT_BEGIN_EXPORT diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 8a130118..7eccc0a7 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -618,7 +618,7 @@ inline auto vsprintf(basic_string_view fmt, * * std::string message = fmt::sprintf("The answer is %d", 42); */ -template > +template > inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string { return vsprintf(detail::to_string_view(fmt), fmt::make_format_args>(args...)); @@ -643,7 +643,7 @@ inline auto vfprintf(std::FILE* f, basic_string_view fmt, * * fmt::fprintf(stderr, "Don't %s!", "panic"); */ -template > +template > inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int { return vfprintf(f, detail::to_string_view(fmt), make_printf_args(args...));