diff --git a/include/fmt/core.h b/include/fmt/core.h index ee72cc01..679c95b7 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -300,6 +300,9 @@ FMT_GCC_PRAGMA("GCC optimize(\"Og\")") FMT_BEGIN_NAMESPACE FMT_MODULE_EXPORT_BEGIN +// Alias for older systems where std::wstring isn't defined. +using wstring = std::basic_string; + // Implementations of enable_if_t and other metafunctions for older systems. template using enable_if_t = typename std::enable_if::type; diff --git a/include/fmt/format.h b/include/fmt/format.h index 45af8c85..3efdfa4b 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -1232,7 +1232,7 @@ class utf8_to_utf16 { operator basic_string_view() const { return {&buffer_[0], size()}; } auto size() const -> size_t { return buffer_.size() - 1; } auto c_str() const -> const wchar_t* { return &buffer_[0]; } - auto str() const -> std::wstring { return {&buffer_[0], size()}; } + auto str() const -> wstring { return {&buffer_[0], size()}; } }; namespace dragonbox { diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 30c04a2d..1c549bfd 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -138,9 +138,13 @@ void print(std::ostream& os, format_string fmt, Args&&... args) { vprint(os, fmt, fmt::make_format_args(args...)); } +// Alias for older systems where std::wostream isn't defined. +FMT_MODULE_EXPORT +using wostream = std::basic_ostream; + FMT_MODULE_EXPORT template -void print(std::wostream& os, +void print(wostream& os, basic_format_string...> fmt, Args&&... args) { vprint(os, fmt, fmt::make_format_args>(args...)); diff --git a/include/fmt/xchar.h b/include/fmt/xchar.h index 9b57815d..aa61b181 100644 --- a/include/fmt/xchar.h +++ b/include/fmt/xchar.h @@ -227,7 +227,7 @@ template void print(wformat_string fmt, T&&... args) { /** Converts *value* to ``std::wstring`` using the default format for type *T*. */ -template inline auto to_wstring(const T& value) -> std::wstring { +template inline auto to_wstring(const T& value) -> wstring { return format(FMT_STRING(L"{}"), value); } FMT_MODULE_EXPORT_END