Give FFPoint one way to copy itself - #191
Open
HugoFara wants to merge 1 commit into
Open
Conversation
Both hand-write a copy-constructor and leave assignment to the compiler, so each class carries two independently maintained definitions of how to copy itself. They agree today. They stop agreeing the moment anyone adds a member: the generated assignment picks it up, the hand-written constructor does not, leaving `FFPoint b(a)` and `b = a` producing different objects. FFPoint carries every coordinate in the simulation. Writing the assignment operator out puts both next to each other, so a new member has to be added to both or the omission is visible in one file. Behaviour is unchanged: three doubles each, owning nothing. Contributes to #161, which is where this came to notice: 65 of its 428 warning lines were the missing operator. The issue attributes all 65 to FFPoint; 51 are, the other 14 are FFVector, which has the same shape.
antonio-leblanc
approved these changes
Aug 14, 2026
Collaborator
There was a problem hiding this comment.
LGTM. Went through both classes fully, not just the diff — FFPoint/FFVector only hold doubles, no owned resources, so this operator= is byte-for-byte what the compiler was already synthesizing implicitly.
Behavior's unchanged, and since nothing here touches ROS/propagation logic, no physics impact either — this is pure C++ hygiene, just silences -Wdeprecated-copy.
Safe to merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
FFPointis the type every coordinate in the simulation passes through, and copy is defined ambiguously with assignement.FFPoint b(a);andb = a;then produce different objects.So the assignment operator is written out, directly below the copy-constructor, where a future member has to be added to both or the omission is visible in one file.
FFVectorhas the identical shape and gets the identical treatment. Behaviour is unchanged: the member-wise copy written here is exactly what the compiler was generating.Verification
Unit suite 4/4,
runffKML and NetCDF both match within tolerance.One thing noticed and deliberately left alone: nothing derives from either class, so those virtual destructors cost every
FFPointa vptr for nothing. Removing them is a future decision.Contributes to #161.
This pull request, including its code changes and this description, was generated by Claude Opus 5, and reviewed manually before submitting.