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

Fix -Wrange-loop-construct #245

Merged
merged 1 commit into from
Mar 24, 2020
Merged

Conversation

rotu
Copy link
Contributor

@rotu rotu commented Mar 23, 2020

--- stderr: tf2_ros
/opt/ros/master/src/ros2/geometry2/tf2_ros/test/test_buffer.cpp:84:21: warning: loop variable 'elem' creates a copy from type 'const std::pair<const unsigned long, std::function<void (const unsigned long &)> >' [-Wrange-loop-construct]
    for (const auto elem : timer_to_callback_map_) {
                    ^
/opt/ros/master/src/ros2/geometry2/tf2_ros/test/test_buffer.cpp:84:10: note: use reference type 'const std::pair<const unsigned long, std::function<void (const unsigned long &)> > &' to prevent copying
    for (const auto elem : timer_to_callback_map_) {
         ^~~~~~~~~~~~~~~~~
                    &
1 warning generated.
---

```
--- stderr: tf2_ros
/opt/ros/master/src/ros2/geometry2/tf2_ros/test/test_buffer.cpp:84:21: warning: loop variable 'elem' creates a copy from type 'const std::pair<const unsigned long, std::function<void (const unsigned long &)> >' [-Wrange-loop-construct]
    for (const auto elem : timer_to_callback_map_) {
                    ^
/opt/ros/master/src/ros2/geometry2/tf2_ros/test/test_buffer.cpp:84:10: note: use reference type 'const std::pair<const unsigned long, std::function<void (const unsigned long &)> > &' to prevent copying
    for (const auto elem : timer_to_callback_map_) {
         ^~~~~~~~~~~~~~~~~
                    &
1 warning generated.
---
```
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable to me. Will run CI on it next.

@clalancette
Copy link
Contributor

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

All builds green, merging. Thanks for the contribution.

@clalancette clalancette merged commit 8599c8d into ros2:ros2 Mar 24, 2020
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.

None yet

2 participants