Implement println (#3267)
This commit is contained in:
@@ -3009,6 +3009,36 @@ FMT_INLINE void print(std::FILE* f, format_string<T...> fmt, T&&... args) {
|
||||
: detail::vprint_mojibake(f, fmt, vargs);
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Formats ``args`` according to specifications in ``fmt`` and writes the
|
||||
output to the file ``f`` followed by a newline.
|
||||
|
||||
**Example**::
|
||||
|
||||
fmt::println(stderr, "Don't {}!", "panic");
|
||||
\endrst
|
||||
*/
|
||||
template <typename... T>
|
||||
FMT_INLINE void println(std::FILE* f, format_string<T...> fmt, T&&... args) {
|
||||
return fmt::print(f, "{}\n", fmt::format(fmt, std::forward<T>(args)...));
|
||||
}
|
||||
|
||||
/**
|
||||
\rst
|
||||
Formats ``args`` according to specifications in ``fmt`` and writes the output
|
||||
to ``stdout`` followed by a newline.
|
||||
|
||||
**Example**::
|
||||
|
||||
fmt::println("Elapsed time: {0:.2f} seconds", 1.23);
|
||||
\endrst
|
||||
*/
|
||||
template <typename... T>
|
||||
FMT_INLINE void println(format_string<T...> fmt, T&&... args) {
|
||||
return fmt::println(stdout, fmt, std::forward<T>(args)...);
|
||||
}
|
||||
|
||||
FMT_MODULE_EXPORT_END
|
||||
FMT_GCC_PRAGMA("GCC pop_options")
|
||||
FMT_END_NAMESPACE
|
||||
|
||||
Reference in New Issue
Block a user