utils: add mu_print[ln] for ostreams

This commit is contained in:
Dirk-Jan C. Binnema 2023-08-11 19:55:43 +03:00
parent 677a6d3882
commit 11df0bedce
1 changed files with 13 additions and 1 deletions

View File

@ -44,6 +44,7 @@
#include <fmt/format.h>
#include <fmt/core.h>
#include <fmt/chrono.h>
#include <fmt/ostream.h>
namespace Mu {
@ -100,7 +101,7 @@ void mu_error(fmt::format_string<T...> frm, T&&... args) noexcept {
}
/*
* Printing
* Printing; add our wrapper functions, one day we might be able to use std::
*/
template<typename...T>
@ -111,6 +112,7 @@ template<typename...T>
void mu_println(fmt::format_string<T...> frm, T&&... args) noexcept {
fmt::println(frm, std::forward<T>(args)...);
}
template<typename...T>
void mu_printerr(fmt::format_string<T...> frm, T&&... args) noexcept {
fmt::print(stderr, frm, std::forward<T>(args)...);
@ -121,6 +123,16 @@ void mu_printerrln(fmt::format_string<T...> frm, T&&... args) noexcept {
}
/* stream */
template<typename...T>
void mu_print(std::ostream& os, fmt::format_string<T...> frm, T&&... args) noexcept {
fmt::print(os, frm, std::forward<T>(args)...);
}
template<typename...T>
void mu_println(std::ostream& os, fmt::format_string<T...> frm, T&&... args) noexcept {
fmt::println(os, frm, std::forward<T>(args)...);
}
/*
* Fprmatting
*/