Skip to content

[wpimath] Pass Translation2d by const reference instead of by value #8021

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

Conversation

MichaelLesirge
Copy link
Contributor

Quick fix to update nearest method of Translation2d to pass values by const ref instead of by value in min_element's llamada.

When adding the Translation3d method, calcmogul noticed both C++ translation methods needed a fix.

Translation2d should be updated similarly, now that I'm looking at it. The rule of thumb is to pass anything larger than the machine word size (e.g., 32 bits on a 32-bit system) by const ref.
Separate branch/PR.

@MichaelLesirge MichaelLesirge requested a review from a team as a code owner June 13, 2025 18:23
@github-actions github-actions bot added the component: wpimath Math library label Jun 13, 2025
@calcmogul calcmogul changed the title Quick fix, pass Translation2d as const reference instead of by value [wpimath] Pass Translation2d by const reference instead of by value Jun 13, 2025
@PeterJohnson PeterJohnson merged commit 05c0803 into wpilibsuite:main Jun 14, 2025
44 checks passed
@MichaelLesirge MichaelLesirge deleted the translation2d-const-ref-quick-fix branch June 16, 2025 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pass comparator arguments in Translation2d::Nearest() by const reference
3 participants