mirror of https://github.com/djcb/mu.git
utils: add mu_print[ln] for ostreams
This commit is contained in:
parent
677a6d3882
commit
11df0bedce
|
@ -44,6 +44,7 @@
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <fmt/core.h>
|
#include <fmt/core.h>
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
|
#include <fmt/ostream.h>
|
||||||
|
|
||||||
namespace Mu {
|
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>
|
template<typename...T>
|
||||||
|
@ -111,6 +112,7 @@ template<typename...T>
|
||||||
void mu_println(fmt::format_string<T...> frm, T&&... args) noexcept {
|
void mu_println(fmt::format_string<T...> frm, T&&... args) noexcept {
|
||||||
fmt::println(frm, std::forward<T>(args)...);
|
fmt::println(frm, std::forward<T>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename...T>
|
template<typename...T>
|
||||||
void mu_printerr(fmt::format_string<T...> frm, T&&... args) noexcept {
|
void mu_printerr(fmt::format_string<T...> frm, T&&... args) noexcept {
|
||||||
fmt::print(stderr, frm, std::forward<T>(args)...);
|
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
|
* Fprmatting
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue