From f6d481f120cacf6bf09db4b5129a60801a54814e Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 29 Jun 2014 14:22:53 -0700 Subject: [PATCH] Improve example. --- README.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.rst b/README.rst index 34408b5f..203b7fb5 100644 --- a/README.rst +++ b/README.rst @@ -99,13 +99,14 @@ which take arbitrary arguments: .. code-block:: c++ - // Prints formatted error message to std::cerr. - void ReportError(const char *format_str, const fmt::ArgList &args) { - std::cerr << "Error: " << fmt::format(format_str, args) << std::endl; + // Prints formatted error message. + void report_error(const char *format, const fmt::ArgList &args) { + fmt::print("Error: {}"); + fmt::print(format, args); } - FMT_VARIADIC(void, ReportError, const char *) + FMT_VARIADIC(void, report_error, const char *) - ReportError("File not found: {}", path); + report_error("file not found: {}", path); Note that you only need to define one function that takes ``const fmt::ArgList &`` argument and ``FMT_VARIADIC`` automatically defines necessary wrappers that