Skip to content

Commit

Permalink
utils: add mu_print[ln] for ostreams
Browse files Browse the repository at this point in the history
  • Loading branch information
djcb committed Aug 11, 2023
1 parent 677a6d3 commit 11df0be
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion lib/utils/mu-utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <fmt/format.h>
#include <fmt/core.h>
#include <fmt/chrono.h>
#include <fmt/ostream.h>

namespace Mu {

Expand Down Expand Up @@ -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>
Expand All @@ -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)...);
Expand All @@ -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
*/
Expand Down

0 comments on commit 11df0be

Please sign in to comment.