Skip to content

fix: push_back to emplace_back done by AI#5314

Open
asalzburger wants to merge 2 commits intoacts-project:mainfrom
asalzburger:fix-pushback-emplaceback
Open

fix: push_back to emplace_back done by AI#5314
asalzburger wants to merge 2 commits intoacts-project:mainfrom
asalzburger:fix-pushback-emplaceback

Conversation

@asalzburger
Copy link
Copy Markdown
Contributor

PR Summary: Implicit conversion/narrowing + push_backemplace_back

*** This was done using Cursor on top of our SonarCloud report ***

Summary

This PR applies mechanical numeric-conversion cleanups and container insertion improvements to address SonarCloud findings around implicit conversion / narrowing and push_back vs emplace_back. No algorithms were intended to change; changes are focused on making conversions explicit and matching the most appropriate container API.

What changed

Implicit conversion / narrowing fixes

  • Added explicit static_cast at conversion boundaries (index-size types, arithmetic promotions, and doublefloat assignments).
  • Added f suffixes / explicit float literals where configuration fields are float.
  • Made mixed signed/unsigned index math explicit (e.g. via static_cast<int>(idx) before adding signed offsets).

push_backemplace_back

  • Replaced push_back with emplace_back in the Sonar-flagged call sites (and adjusted braced initialization where needed to keep the code compiling).
  • Updated pair/tuple insertions to use the correct emplace_back(...) argument form.
  • Converted tapVec.push_back(std::make_pair(...)) to tapVec.emplace_back(..., ...) in CuboidVolumeBuilder.cpp.

Files (high level)

  • Implicit conversion/narrowing: touched multiple headers/sources across Core, ActsAlignment, utilities, and geometry builders.
  • push_backemplace_back (explicitly fixed in the last pass):
    • Core/include/Acts/Utilities/Table.hpp
    • Core/src/EventData/CorrectedTransformationFreeToBound.cpp
    • Core/src/Geometry/{Cone,Cuboid,Cylinder,Diamond}VolumeBounds.cpp
    • Core/src/Geometry/GenericCuboidVolumeBounds.cpp
    • Core/src/Geometry/CuboidVolumeBuilder.cpp
    • Core/src/Geometry/LayerArrayCreator.cpp

Verification

  • Built: ActsCore (and earlier ActsAlignment) with warnings enabled for float conversion.
  • Tests executed (unit tests related to the touched code paths):
    • ActsUnitTestConeVolumeBounds
    • ActsUnitTestCuboidVolumeBounds
    • ActsUnitTestCylinderVolumeBounds
    • ActsUnitTestDiamondVolumeBounds
    • ActsUnitTestGenericCuboidVolumeBounds
    • ActsUnitTestCorrectedTransformFreeToBound
    • ActsUnitTestTable
    • ActsUnitTestCuboidVolumeBuilder
    • ActsUnitTestLayerCreator

SonarCloud export bookkeeping (local JSON)

  • Updated local sc_issues.json export:
    • implicit_conversion_narrowing_resolved_count = 184
    • push_back_emplace_back_resolved_count = 40
    • JSON path: /Users/salzburg/Documents/work/installed/acts-sonarcloud/sonarcloud/sc_issues.json

--- END COMMIT MESSAGE ---

Any further description goes here, @-mentions are ok here!

  • Use a conventional commits prefix: quick summary
    • We mostly use feat, fix, refactor, docs, chore and build types.
  • A milestone will be assigned by one of the maintainers

@github-actions github-actions bot added Component - Core Affects the Core module Event Data Model labels Apr 3, 2026
@github-actions github-actions bot added this to the next milestone Apr 3, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

📊: Physics performance monitoring for c761be9

Full contents

physmon summary

Copy link
Copy Markdown
Contributor Author

@asalzburger asalzburger left a comment

Choose a reason for hiding this comment

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

Adressing PR comments - by passing arguments directly.

@asalzburger asalzburger requested a review from andiwand April 4, 2026 05:02
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 4, 2026

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.

2 participants