Variadic version of BasicFormatter's ctor.

This commit is contained in:
Victor Zverovich 2013-12-06 09:08:37 -08:00
parent 383cc773e2
commit 5789930096

View File

@ -36,6 +36,7 @@
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <algorithm> #include <algorithm>
#include <initializer_list>
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include <stdexcept> #include <stdexcept>
@ -994,6 +995,14 @@ class BasicFormatter {
BasicFormatter(BasicWriter<Char> &w, const Char *format = 0) BasicFormatter(BasicWriter<Char> &w, const Char *format = 0)
: writer_(&w), format_(format) {} : writer_(&w), format_(format) {}
// Constructs a formatter with formatting arguments.
BasicFormatter(BasicWriter<Char> &w,
const Char *format, std::initializer_list<Arg> args)
: writer_(&w), format_(format) {
for (const Arg &arg: args)
Add(arg);
}
// Perfoms formatting if the format string is non-null. The format string // Perfoms formatting if the format string is non-null. The format string
// can be null if its ownership has been transferred to another formatter. // can be null if its ownership has been transferred to another formatter.
~BasicFormatter() { ~BasicFormatter() {