mirror of
https://github.com/fmtlib/fmt.git
synced 2025-08-02 12:14:43 +02:00
Pre-allocate space for arguments.
This commit is contained in:
1
format.h
1
format.h
@@ -999,6 +999,7 @@ class BasicFormatter {
|
|||||||
BasicFormatter(BasicWriter<Char> &w,
|
BasicFormatter(BasicWriter<Char> &w,
|
||||||
const Char *format, std::initializer_list<Arg> args)
|
const Char *format, std::initializer_list<Arg> args)
|
||||||
: writer_(&w), format_(format) {
|
: writer_(&w), format_(format) {
|
||||||
|
args_.reserve(args.size());
|
||||||
for (const Arg &arg: args)
|
for (const Arg &arg: args)
|
||||||
Add(arg);
|
Add(arg);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user