Reserve memory before adding elements to parse trees

This commit is contained in:
Username404 2021-09-19 20:48:08 +02:00
parent beea9bfadf
commit 1371457a1f
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 1 additions and 0 deletions

View File

@ -52,6 +52,7 @@ class ParseTree {
void addComponent(const T& component) const {
subComponents.emplace_back(new T(component));
}; IS_PARSECOMPONENT void addAllComponents(const initializer_list<T>& components) const {
subComponents.reserve(components.size());
for (const T& comp: components) addComponent<T>(comp);
}
protected: