Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential crash: std::vector::resize and std::vector::reserve #151

Open
Fr3ya opened this issue Jan 13, 2021 · 0 comments · May be fixed by #178
Open

Potential crash: std::vector::resize and std::vector::reserve #151

Fr3ya opened this issue Jan 13, 2021 · 0 comments · May be fixed by #178

Comments

@Fr3ya
Copy link

Fr3ya commented Jan 13, 2021

This issue lies in the test/kvec_test.cc line 57

The function of resize() and reserve() is a little similar, but reserve() only gives to enough room so that future call that leads to increase of the size (e.g. calling push_back()) will be more efficient. So maybe line57 as follows is better:
for (j = 0; j < N; ++j) array.push_back(j);

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 a pull request may close this issue.

1 participant