Skip to content

Vector states correct reserved space#179

Merged
complexlogic merged 1 commit intocomplexlogic:masterfrom
evan314159:vector-reserve
Mar 8, 2026
Merged

Vector states correct reserved space#179
complexlogic merged 1 commit intocomplexlogic:masterfrom
evan314159:vector-reserve

Conversation

@evan314159
Copy link
Contributor

Original code:

size_t nb_states = tracks.size();
std::vector<ebur128_state*> states(nb_states);

initialises the vector with nb_states nulls. Later call to states.emplace_back(track.ebur128.get()) adds the EBU R128 result after the nulls. Corrected to reserve tracks.size() elements without inserting nulls.

Original code:

size_t nb_states = tracks.size();
std::vector<ebur128_state*> states(nb_states);

initialises the vector with nb_states nulls.  Later call to states.emplace_back(track.ebur128.get()) adds
the EBU R128 result after the nulls.  Corrected to reserve tracks.size() elements without inserting nulls.
@complexlogic complexlogic merged commit 9ab975a into complexlogic:master Mar 8, 2026
1 of 5 checks passed
@complexlogic
Copy link
Owner

Good catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants