Skip to content

Vector states correct reserved space#179

Merged
complexlogic merged 1 commit into
masterfrom
unknown repository
Mar 8, 2026
Merged

Vector states correct reserved space#179
complexlogic merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Mar 8, 2026

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
Copy Markdown
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.

1 participant