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

use const auto & to iterate over parameters #1593

Merged
merged 1 commit into from
Mar 23, 2021
Merged

Commits on Mar 23, 2021

  1. use const auto & to iterate over parameters

    Clang is complaining about the looping variable being referenced as `const val` but should rather be `const ref`.
    
    ```
    /Users/karsten/workspace/ros2/ros2_master/src/ros2/rclcpp/rclcpp/src/rclcpp/parameter_service.cpp:46:25: error: loop variable 'param' of type 'const rclcpp::Parameter' creates a copy from type 'const rclcpp::Parameter' [-Werror,-Wrange-loop-construct]
            for (const auto param : parameters) {
                            ^
    /Users/karsten/workspace/ros2/ros2_master/src/ros2/rclcpp/rclcpp/src/rclcpp/parameter_service.cpp:46:14: note: use reference type 'const rclcpp::Parameter &' to prevent copying
            for (const auto param : parameters) {
                 ^~~~~~~~~~~~~~~~~~
                            &
    1 error generated.
    ```
    
    Signed-off-by: Karsten Knese <Karsten1987@users.noreply.github.com>
    Karsten1987 committed Mar 23, 2021
    Configuration menu
    Copy the full SHA
    50972d8 View commit details
    Browse the repository at this point in the history