23 using printer_t =
void (*)(std::string_view);
24 using flush_t =
void (*)();
26 static printer_t _printer =
nullptr;
27 static printer_t _printerln =
nullptr;
28 static flush_t _flush =
nullptr;
30 void print(std::string_view s) {
31 if (_printer ==
nullptr) {
38 if (_printerln ==
nullptr) {
39 std::cout << s <<
"\n";
45 if (_flush ==
nullptr) {
46 std::cout << std::flush;
namespace for basic c++ utilities
void println(std::string_view sv)
Prints a string to the console followed by a newline.
void throw_with_loc(std::string message, SourceLocation loc=SourceLocation{})
Throw an exception and append the source location to it.
void print(std::string_view sv)
Prints a string to the console.
void flush()
Flushes the output buffer.
void reset_std_behavior()
Restores the default behavior of the print and println functions.
void change_printer(void(*func_printer_normal)(std::string_view), void(*func_printer_ln)(std::string_view), void(*func_flush_func)())
Changes the behavior of the print, println and flush functions.