mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-01 22:51:44 +01:00
Add an overload of print that accepts std::ostream.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
Formatting library for C++
|
||||
|
||||
Copyright (c) 2012, Victor Zverovich
|
||||
Copyright (c) 2012 - 2014, Victor Zverovich
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -1122,6 +1122,12 @@ void fmt::print(std::FILE *f, StringRef format, const ArgList &args) {
|
||||
std::fwrite(w.data(), 1, w.size(), f);
|
||||
}
|
||||
|
||||
void fmt::print(std::ostream &os, StringRef format, const ArgList &args) {
|
||||
Writer w;
|
||||
w.write(format, args);
|
||||
os.write(w.data(), w.size());
|
||||
}
|
||||
|
||||
void fmt::print_colored(Color c, StringRef format, const ArgList &args) {
|
||||
char escape[] = "\x1b[30m";
|
||||
escape[3] = '0' + static_cast<char>(c);
|
||||
|
||||
Reference in New Issue
Block a user