-
Notifications
You must be signed in to change notification settings - Fork 386
hardware_interface: fix C++20 structured-binding capture in lambda (fixes #2574) #2832
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
hardware_interface: fix C++20 structured-binding capture in lambda (fixes #2574) #2832
Conversation
christophfroehlich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see this pattern four times in this file, can you please fix them all at once?
saikishor
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too advanced hahaha
I added it as the GCC supported it from 22.04 on. Sure, let's change it
|
@christophfroehlich I'm only finding one occurrence of a structured binding capture within a lambda. Could you please clarify if you mean structured bindings in general that should be fixed, or if there's a different pattern I'm missing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just looked for the & [hw_name, limiters] : pattern, but the problem is the lambda capture which happens only once. sorry for the confusion
1757bd1
into
ros-controls:master
(cherry picked from commit 1757bd1)
(cherry picked from commit 1757bd1)
Remove the
-Wc++20-extensionswarning triggered by capturing a structured binding in a lambda.ROS 2 still targets C++17 only (REP-2000). Capturing structured bindings directly is a C++20 extension, so we avoid it by using
.secondexplicitly instead. The unused first element (hw_name / entry.first) is omitted to avoid the separate -Wunused-variable warning/error.No functional change.
Fixes #2574
Tested locally:
colcon build --packages-select hardware_interfacecolcon test --packages-select hardware_interface- all tests pass