Reserve memory before adding elements to parse trees
This commit is contained in:
parent
beea9bfadf
commit
1371457a1f
|
@ -52,6 +52,7 @@ class ParseTree {
|
||||||
void addComponent(const T& component) const {
|
void addComponent(const T& component) const {
|
||||||
subComponents.emplace_back(new T(component));
|
subComponents.emplace_back(new T(component));
|
||||||
}; IS_PARSECOMPONENT void addAllComponents(const initializer_list<T>& components) const {
|
}; IS_PARSECOMPONENT void addAllComponents(const initializer_list<T>& components) const {
|
||||||
|
subComponents.reserve(components.size());
|
||||||
for (const T& comp: components) addComponent<T>(comp);
|
for (const T& comp: components) addComponent<T>(comp);
|
||||||
}
|
}
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue