mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Avoid wchar_t instantiations
This commit is contained in:
parent
3bc28fcc6b
commit
62da1db62a
@ -1478,7 +1478,6 @@ inline std::basic_string<Char> format(const S& format_str, Args&&... args) {
|
||||
}
|
||||
|
||||
FMT_API void vprint(std::FILE* f, string_view format_str, format_args args);
|
||||
FMT_API void vprint(std::FILE* f, wstring_view format_str, wformat_args args);
|
||||
|
||||
/**
|
||||
\rst
|
||||
@ -1499,7 +1498,6 @@ inline void print(std::FILE* f, const S& format_str, Args&&... args) {
|
||||
}
|
||||
|
||||
FMT_API void vprint(string_view format_str, format_args args);
|
||||
FMT_API void vprint(wstring_view format_str, wformat_args args);
|
||||
|
||||
/**
|
||||
\rst
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
#include <cerrno>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <cstdarg>
|
||||
@ -1384,23 +1383,10 @@ FMT_FUNC void vprint(std::FILE* f, string_view format_str, format_args args) {
|
||||
internal::fwrite_fully(buffer.data(), 1, buffer.size(), f);
|
||||
}
|
||||
|
||||
FMT_FUNC void vprint(std::FILE* f, wstring_view format_str, wformat_args args) {
|
||||
wmemory_buffer buffer;
|
||||
internal::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"));
|
||||
}
|
||||
}
|
||||
|
||||
FMT_FUNC void vprint(string_view format_str, format_args args) {
|
||||
vprint(stdout, format_str, args);
|
||||
}
|
||||
|
||||
FMT_FUNC void vprint(wstring_view format_str, wformat_args args) {
|
||||
vprint(stdout, format_str, args);
|
||||
}
|
||||
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
@ -34,6 +34,7 @@
|
||||
#define FMT_FORMAT_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <cerrno>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
@ -3446,6 +3447,21 @@ inline std::size_t formatted_size(string_view format_str, const Args&... args) {
|
||||
return format_to(internal::counting_iterator(), format_str, args...).count();
|
||||
}
|
||||
|
||||
template <typename Char, FMT_ENABLE_IF(std::is_same<Char, wchar_t>::value)>
|
||||
void vprint(std::FILE* f, basic_string_view<Char> format_str,
|
||||
wformat_args args) {
|
||||
wmemory_buffer buffer;
|
||||
internal::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 <typename Char, FMT_ENABLE_IF(std::is_same<Char, wchar_t>::value)>
|
||||
void vprint(basic_string_view<Char> format_str, wformat_args args) {
|
||||
vprint(stdout, format_str, args);
|
||||
}
|
||||
|
||||
#if FMT_USE_USER_DEFINED_LITERALS
|
||||
namespace internal {
|
||||
|
||||
|
@ -58,9 +58,6 @@ template FMT_API wchar_t internal::decimal_point_impl(locale_ref);
|
||||
template FMT_API void internal::buffer<wchar_t>::append(const wchar_t*,
|
||||
const wchar_t*);
|
||||
|
||||
template FMT_API void internal::arg_map<wformat_context>::init(
|
||||
const basic_format_args<wformat_context>&);
|
||||
|
||||
template FMT_API std::wstring internal::vformat<wchar_t>(
|
||||
wstring_view, basic_format_args<wformat_context>);
|
||||
FMT_END_NAMESPACE
|
||||
|
Loading…
Reference in New Issue
Block a user