Add const "guards" in correspondence estimation #6346
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add const keyword to function parameters which are not meant to be modified inside the function in correspondence estimation classes
Add const keyword to local variables which are not meant to be modified in correspondence estimation classes except for variables in clone() functions
Background
I was looking into #329, #4901, and other when noticed some variables and parameters not being
const
. So I decided to "improve" the code when I had an opportunity.Variables in
clone()
functionsI didn't change constness of variable
copy
inclone()
functions because I am just unsure about NRVO in this case. Maybe I should have addedconst
in these cases. But that can be done later anyway.About
const
function parameters passed by valueThere are multiple opinions on the usage of
const
with function parameters passed by value in the C++ community. I usedconst
with function parameters in this pull request to prevent mistakes when a parameter is modified inside the function but should not be. We can discuss it andconst
in function declarations and etc. further if you need or want to.P.S.
I also noticed other non-critical things but, probably, I should try to prioritize tasks to do more important contributions.