From 5789930096a3146f67ca63a6a93d7b69ce06c33b Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 6 Dec 2013 09:08:37 -0800 Subject: [PATCH] Variadic version of BasicFormatter's ctor. --- format.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/format.h b/format.h index 7c37bc2a..f336aeca 100644 --- a/format.h +++ b/format.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -994,6 +995,14 @@ class BasicFormatter { BasicFormatter(BasicWriter &w, const Char *format = 0) : writer_(&w), format_(format) {} + // Constructs a formatter with formatting arguments. + BasicFormatter(BasicWriter &w, + const Char *format, std::initializer_list args) + : writer_(&w), format_(format) { + for (const Arg &arg: args) + Add(arg); + } + // Perfoms formatting if the format string is non-null. The format string // can be null if its ownership has been transferred to another formatter. ~BasicFormatter() {