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 TransformPhysicalPointToIndex, TransformPhysicalPointToContinuousIndex [[nodiscard]] warnings #4000

Commits on Apr 6, 2023

  1. COMP: Fix TransformPhysicalPointToIndex nodiscard warnings

    When the `bool` return value of a `TransformPhysicalPointToIndex(point, index)`
    call can be ignored, it is preferable (for performance reasons) to call the
    `TransformPhysicalPointToIndex(point)` overload that just returns the index,
    preventing `[[nodiscard]]` compile warnings.
    
    These cases are found in Visual Studio, using the following regular expression:
    `  [^ ]+->TransformPhysicalPointToIndex\(.*,`
    N-Dekker committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    9fadaa1 View commit details
    Browse the repository at this point in the history
  2. COMP: Fix TransformPhysicalPointToContinuousIndex nodiscard warnings

    Did find code like this:
    
        ContinuousIndexType index;
        image->TransformPhysicalPointToContinuousIndex(point, index);
    
    And replaced it by something like:
    
        const ContinuousIndexType index =
          image->template TransformPhysicalPointToContinuousIndex<ContinuousIndexValueType>(point);
    
    When the `bool` return value is ignored, it is preferable (for performance
    reasons) to call the overload that just returns the continuous index, preventing
    `[[nodiscard]]` compile warnings.
    
    These cases are found in Visual Studio, using the following regular expression:
    `  [^ ]+->TransformPhysicalPointToContinuousIndex\(.*,`
    N-Dekker committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    3f16044 View commit details
    Browse the repository at this point in the history