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

ProgramMemory: no longer offer mutable iterators #6653

Merged
merged 1 commit into from
Aug 1, 2024

Conversation

firewave
Copy link
Collaborator

@firewave firewave commented Jul 31, 2024

This avoids copy-on-write with range loops.

@firewave
Copy link
Collaborator Author

-D__GNUC__ --check-level=exhaustive ../lib/utils.cpp

Clang 17 773,369,412 -> 767,405,289
GCC 14 794,493,015 -> 788,810,953

The example from https://trac.cppcheck.net/ticket/10765#comment:4:

Clang 17 3,988,168,871 -> 3,988,074,912
GCC 14 4,098,327,498 -> 4,098,726,601

@firewave
Copy link
Collaborator Author

firewave commented Aug 1, 2024

Suggesting std::as_const() is tracked via https://trac.cppcheck.net/ticket/11208.

@pfultz2
Copy link
Contributor

pfultz2 commented Aug 1, 2024

Can we just remove the non-const overload for begin and end? I dont think its ever used.

@firewave
Copy link
Collaborator Author

firewave commented Aug 1, 2024

Can we just remove the non-const overload for begin and end? I dont think its ever used.

Actually - yes.

@firewave firewave changed the title programmemory.cpp: avoid usage of non-const ProgramMemory::begin() ProgramMemory: no longer offer mutable iterators Aug 1, 2024
@chrchr-github chrchr-github merged commit ccc8410 into danmar:main Aug 1, 2024
63 checks passed
@firewave firewave deleted the pm-const-3 branch August 1, 2024 23:05
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.

3 participants