Skip to content

Commit

Permalink
Use a for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Apr 19, 2024
1 parent 8637d97 commit 98703c6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions python/templates/macros/implementations.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ 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
delete tmp->m_{{ relation.name }};
tmp->m_{{ relation.name }} = new std::vector<{{ relation.full_type }}>(m_obj->m_{{ relation.name }}->begin() + m_obj->data.{{ relation.name }}_begin, m_obj->m_{{ relation.name }}->begin() + m_obj->data.{{ relation.name }}_end);
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]);
}
tmp->data.{{ relation.name }}_begin = 0;
tmp->data.{{ relation.name }}_end = tmp->m_{{ relation.name }}->size();
{% endfor %}
Expand Down

0 comments on commit 98703c6

Please sign in to comment.