From d029b2db15f3c91f9c1d7fc4417ceb486c3d78d8 Mon Sep 17 00:00:00 2001 From: Daumantas Kavolis <12998363+dkavolis@users.noreply.github.com> Date: Thu, 26 Sep 2019 16:14:28 +0100 Subject: [PATCH] overload `print` from fmt/core.h --- include/fmt/compile.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 198f1d21..fb8ad198 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -603,6 +603,26 @@ std::size_t formatted_size(const CompiledFormat& cf, const Args&... args) { .count(); } +template ::value)> +inline void print(std::FILE* f, const CompiledFormat& cf, Args&&... args) { + using Char = char_t; + using context = buffer_context; + basic_memory_buffer buffer; + format_to(std::back_inserter(buffer), cf, args...); + vprint(f, {buffer.begin(), buffer.size()}, {make_format_args()}); +} + +template ::value)> +inline void print(const CompiledFormat& cf, Args&&... args) { + using Char = char_t; + using context = buffer_context; + basic_memory_buffer buffer; + format_to(std::back_inserter(buffer), cf, args...); + vprint({buffer.begin(), buffer.size()}, {make_format_args()}); +} + FMT_END_NAMESPACE #endif // FMT_COMPILE_H_