Remove xchar.h include from ostream.h

This commit is contained in:
Victor Zverovich 2022-03-18 10:46:50 -07:00
parent ac0d9d5fe2
commit 4e39e13085
2 changed files with 7 additions and 4 deletions

View File

@ -11,7 +11,6 @@
#include <ostream>
#include "format.h"
#include "xchar.h"
FMT_BEGIN_NAMESPACE
@ -141,8 +140,10 @@ void print(std::ostream& os, format_string<Args...> fmt, Args&&... args) {
FMT_MODULE_EXPORT
template <typename... Args>
void print(std::wostream& os, wformat_string<Args...> fmt, Args&&... args) {
vprint(os, fmt, fmt::make_wformat_args(args...));
void print(std::wostream& os,
basic_format_string<wchar_t, type_identity_t<Args>...> fmt,
Args&&... args) {
vprint(os, fmt, fmt::make_format_args<buffer_context<wchar_t>>(args...));
}
FMT_END_NAMESPACE

View File

@ -330,9 +330,11 @@ TEST(xchar_test, color) {
}
TEST(xchar_test, ostream) {
#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 409
std::wostringstream wos;
fmt::print(wos, L"Don't {}!", L"panic");
EXPECT_EQ(L"Don't panic!", wos.str());
EXPECT_EQ(wos.str(), L"Don't panic!");
#endif
}
TEST(xchar_test, to_wstring) { EXPECT_EQ(L"42", fmt::to_wstring(42)); }