mirror of
https://github.com/fmtlib/fmt.git
synced 2026-02-11 12:49:57 +08:00
Pre-allocate space for arguments.
This commit is contained in:
parent
5789930096
commit
2d620be6ff
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user