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

[BUG] erase_if returns an incorrect value #76

Closed
sultim-t opened this issue May 21, 2023 · 2 comments
Closed

[BUG] erase_if returns an incorrect value #76

sultim-t opened this issue May 21, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@sultim-t
Copy link

Describe the bug
erase_if returns current_size - old_size which is a negative value that is cast to an unsigned size_t on return.

return map.size() - old_size;

To Reproduce
Steps to reproduce the behavior:

  1. Call erase_if

Expected behavior
erase_if should return old_size - current_size, not current_size - old_size

System (please complete the following information):

  • OS: Windows
  • Compiler: MSVC
  • Version 19.34.31937

Additional context
None.

@sultim-t sultim-t added the bug Something isn't working label May 21, 2023
@martinus
Copy link
Owner

Ha, you are of course correct, this is a bug. It seems whenever I don't have a test for something I'll do it wrong. I'll create a new release with the fix.

@martinus
Copy link
Owner

I've created release v4.0.1 with this fix. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants