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

[container] Fix reducing capacity to 0 on DynamicArray::clear() #1226

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

chris-durand
Copy link
Member

Fixes #1224

@WasabiFan Could you check if the test passes with that fix?

Calling shrink_to_fit() on a std::vector in libstdc++ is a no-op with
exceptions disabled. This fix applies the "vector swap trick" to make
it work even when compiling with -fno-exceptions.
@salkinium salkinium added this to the 2024q4 milestone Nov 12, 2024
@WasabiFan
Copy link
Contributor

I can confirm it passes:

>>> dynamic_array
[...]

Passed 5616 tests
OK!

@WasabiFan
Copy link
Contributor

Clever solution, thanks for the fix!

@salkinium salkinium merged commit 7b571a6 into modm-io:develop Nov 12, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

DynamicArray test failure due to no-op vector::shrink_to_fit implementation
3 participants