From 11df0bedce20d7fe75cb04a3d0a886e5748c3451 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Fri, 11 Aug 2023 19:55:43 +0300 Subject: [PATCH] utils: add mu_print[ln] for ostreams --- lib/utils/mu-utils.hh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/utils/mu-utils.hh b/lib/utils/mu-utils.hh index 0b7543fd..c16c0db8 100644 --- a/lib/utils/mu-utils.hh +++ b/lib/utils/mu-utils.hh @@ -44,6 +44,7 @@ #include #include #include +#include namespace Mu { @@ -100,7 +101,7 @@ void mu_error(fmt::format_string frm, T&&... args) noexcept { } /* - * Printing + * Printing; add our wrapper functions, one day we might be able to use std:: */ template @@ -111,6 +112,7 @@ template void mu_println(fmt::format_string frm, T&&... args) noexcept { fmt::println(frm, std::forward(args)...); } + template void mu_printerr(fmt::format_string frm, T&&... args) noexcept { fmt::print(stderr, frm, std::forward(args)...); @@ -121,6 +123,16 @@ void mu_printerrln(fmt::format_string frm, T&&... args) noexcept { } +/* stream */ +template +void mu_print(std::ostream& os, fmt::format_string frm, T&&... args) noexcept { + fmt::print(os, frm, std::forward(args)...); +} +template +void mu_println(std::ostream& os, fmt::format_string frm, T&&... args) noexcept { + fmt::println(os, frm, std::forward(args)...); +} + /* * Fprmatting */