diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 18ae820c..2d6ad7f8 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -128,12 +128,22 @@ void vprint(std::basic_ostream& os, basic_string_view format_str, fmt::print(cerr, "Don't {}!", "panic"); \endrst */ -template ::value, char_t>> +template , + FMT_ENABLE_IF(internal::is_string::value)> void print(std::basic_ostream& os, const S& format_str, Args&&... args) { vprint(os, to_string_view(format_str), {internal::make_args_checked(format_str, args...)}); } + +// fallback print overload for types that define char_t but are not strings +// such as compiled format +template , + FMT_ENABLE_IF(!internal::is_string::value)> +void print(std::basic_ostream& os, const S& format, Args&&... args) { + basic_memory_buffer buffer; + format_to(std::back_inserter(buffer), format, args...); + internal::write(os, buffer); +} FMT_END_NAMESPACE #endif // FMT_OSTREAM_H_