// Formatting library for C++ - experimental wchar_t support // // Copyright (c) 2012 - present, Victor Zverovich // All rights reserved. // // For the license information refer to format.h. #ifndef FMT_WCHAR_H_ #define FMT_WCHAR_H_ #include #include "format.h" namespace fmt { #if FMT_GCC_VERSION && FMT_GCC_VERSION < 409 // Workaround broken conversion on older gcc. template using wformat_string = wstring_view; #else template using wformat_string = basic_format_string...>; #endif template constexpr format_arg_store make_wformat_args( const Args&... args) { return {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")); } 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 #endif // FMT_WCHAR_H_