diff --git a/include/fmt/core.h b/include/fmt/core.h index 60d1e764..4615e653 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -2718,10 +2718,6 @@ void vformat_to( basic_format_args)> args, detail::locale_ref loc = {}); -template ::value)> -inline void vprint_mojibake(std::FILE*, basic_string_view, const Args&) {} - FMT_API void vprint_mojibake(std::FILE*, string_view, format_args); #ifndef _WIN32 inline void vprint_mojibake(std::FILE*, string_view, format_args) {} @@ -2949,8 +2945,8 @@ FMT_INLINE auto format(format_string str, T&&... args) -> std::string { return detail::vformat(str, make_format_args(args...)); } -FMT_API void vprint(string_view, format_args); FMT_API void vprint(std::FILE*, string_view, format_args); +FMT_API void vprint(string_view, format_args); /** \rst diff --git a/include/fmt/format.h b/include/fmt/format.h index 44f90489..e887d850 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -36,7 +36,6 @@ #include // errno #include // std::signbit #include -#include #include // std::numeric_limits #include // std::uninitialized_copy #include // std::runtime_error @@ -2667,22 +2666,6 @@ FMT_INLINE auto format(const S& format_str, Args&&... args) const auto& vargs = fmt::make_args_checked(format_str, args...); return detail::vformat(to_string_view(format_str), vargs); } - -template ::value)> -void vprint(std::FILE* f, basic_string_view format_str, - wformat_args args) { - wmemory_buffer buffer; - detail::vformat_to(buffer, format_str, args); - buffer.push_back(L'\0'); - if (std::fputws(buffer.data(), f) == -1) - FMT_THROW(system_error(errno, "cannot write to file")); -} - -template ::value)> -void vprint(basic_string_view format_str, wformat_args args) { - vprint(stdout, format_str, args); -} - FMT_MODULE_EXPORT_END #if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS diff --git a/include/fmt/wchar.h b/include/fmt/wchar.h index 8b447ef7..73a5300f 100644 --- a/include/fmt/wchar.h +++ b/include/fmt/wchar.h @@ -8,6 +8,8 @@ #ifndef FMT_WCHAR_H_ #define FMT_WCHAR_H_ +#include + #include "format.h" namespace fmt { @@ -26,13 +28,25 @@ constexpr format_arg_store make_wformat_args( return {args...}; } -template -void print(std::FILE* f, wformat_string str, T&&... args) { - return vprint(f, wstring_view(str), make_wformat_args(args...)); +inline void vprint(std::FILE* f, wstring_view fmt, wformat_args args) { + wmemory_buffer buffer; + detail::vformat_to(buffer, fmt, args); + buffer.push_back(L'\0'); + if (std::fputws(buffer.data(), f) == -1) + FMT_THROW(system_error(errno, "cannot write to file")); } -template void print(wformat_string str, T&&... args) { - return vprint(wstring_view(str), make_wformat_args(args...)); +inline void vprint(wstring_view fmt, wformat_args args) { + vprint(stdout, fmt, args); +} + +template +void print(std::FILE* f, wformat_string fmt, T&&... args) { + return vprint(f, wstring_view(fmt), make_wformat_args(args...)); +} + +template void print(wformat_string fmt, T&&... args) { + return vprint(wstring_view(fmt), make_wformat_args(args...)); } } // namespace fmt