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() {