Parameterize ostream functions on the type of the format string.

Signed-off-by: Daniela Engert <dani@ngrt.de>
This commit is contained in:
Daniela Engert 2018-10-07 15:03:58 +02:00 committed by Victor Zverovich
parent f16a118e88
commit fea712abb1

View File

@ -141,16 +141,12 @@ inline void vprint(std::basic_ostream<Char> &os,
fmt::print(cerr, "Don't {}!", "panic"); fmt::print(cerr, "Don't {}!", "panic");
\endrst \endrst
*/ */
template <typename... Args> template <typename S, typename... Args>
inline void print(std::ostream &os, string_view format_str, inline typename std::enable_if<internal::is_format_string<S>::value>::type
const Args & ... args) { print(std::basic_ostream<FMT_CHAR(S)> &os, const S &format_str,
vprint<char>(os, format_str, make_format_args<format_context>(args...)); const Args & ... args) {
} internal::checked_args<S, Args...> ca(format_str, args...);
vprint(os, internal::to_string_view(format_str), *ca);
template <typename... Args>
inline void print(std::wostream &os, wstring_view format_str,
const Args & ... args) {
vprint<wchar_t>(os, format_str, make_format_args<wformat_context>(args...));
} }
FMT_END_NAMESPACE FMT_END_NAMESPACE