Skip to content

Commit

Permalink
Call reserve first
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Apr 19, 2024
1 parent 98703c6 commit 0eec465
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions python/templates/macros/implementations.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Mutable{{ type }} {{ full_type }}::clone() const {
{% for relation in multi_relations %}
// If the current object has been read from a file, then the object may only have a slice of the relation vector
// so this slice has to be copied in case we want to modify it
tmp->m_{{ relation.name }}->reserve(m_obj->m_{{ relation.name }}->size());
for (size_t i = m_obj->data.{{ relation.name }}_begin; i < m_obj->data.{{ relation.name }}_end; i++) {
tmp->m_{{ relation.name }}->push_back((*m_obj->m_{{ relation.name }})[i]);
}
Expand Down

0 comments on commit 0eec465

Please sign in to comment.