Skip to content

[Fix][Cross-Platform] Replace <types.h> with <cstddef> and remove explicit const from std::map key for macOS - #3548

Merged
rhaschke merged 3 commits into
moveit:mainfrom
idesign0:main
Nov 22, 2025
Merged

rhaschke merged 3 commits into
moveit:mainfrom
idesign0:main

Conversation

@idesign0

@idesign0 idesign0 commented Aug 10, 2025 •

Copy link
Copy Markdown
Contributor

Description

This PR fixes a compilation issue on macOS caused by the use of const std::pair<std::string, std::string> as the key type in a std::map.

Details:

  • The original code used const std::pair as the key type:
using DistanceMap = std::map<const std::pair<std::string, std::string>, std::vector<DistanceResultsData>>;
  • This caused assignment errors because std::map already treats keys as const internally.
  • Explicitly adding const leads to conflicts with internal map operations and strict compiler checks.
  • The fix removes the explicit const qualifier from the key type:
using DistanceMap = std::map<std::pair<std::string, std::string>, std::vector<DistanceResultsData>>;
  • This change ensures compatibility across platforms, including macOS, and adheres to the C++ standard container usage best practices.

[Fix] Use cross-platform <cstddef> instead of <types.h>

Description

Replaces the non-standard <types.h> header with the standard <cstddef> to ensure size_t is available on all platforms. This fixes compilation issues on macOS while remaining compatible with Linux and other platforms.

Changes

- #include <types.h>
+ #include <cstddef>  // for size_t, cross-platform

@forrest-rm forrest-rm left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks simple enough

@idesign0

Copy link
Copy Markdown
Contributor Author

Looks simple enough
can you push it further? :)

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 45 days with no activity. Please tag a maintainer for help on completing this PR, or close it if you think it has become obsolete.

@github-actions github-actions Bot added the stale label Oct 13, 2025
@idesign0 idesign0 changed the title Fix: Remove explicit const from std::map key type to prevent assignment errors on macOS [Fix][Cross-Platform] Replace <types.h> with <cstddef> and remove explicit const from std::map key for macOS Nov 21, 2025
@codecov

codecov Bot commented Nov 21, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.22%. Comparing base (f6acd91) to head (a2e8c3e).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3548      +/-   ##
==========================================
+ Coverage   46.17%   46.22%   +0.06%     
==========================================
  Files         720      720              
  Lines       59179    59175       -4     
  Branches     7595     7596       +1     
==========================================
+ Hits        27320    27348      +28     
+ Misses      31692    31660      -32     
  Partials      167      167              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rhaschke
rhaschke merged commit c639959 into moveit:main Nov 22, 2025
1 check passed
@github-project-automation github-project-automation Bot moved this to ✅ Done in MoveIt Nov 22, 2025
helen9975 pushed a commit to personalrobotics/moveit2 that referenced this pull request Feb 17, 2026
* Remove const specifier from key in DistanceMap = std::map
* Use cross-platform <cstddef> instead of <types.h>

Signed-off-by: Dhruv Patel <[email protected]>
@130s 130s added the backport-jazzy Mergify label that triggers a PR backport to Jazzy label Sep 28, 2026
@130s

This comment was marked as resolved.

@mergify

mergify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

backport jazzy

✅ Backports have been created

Details

130s pushed a commit that referenced this pull request Nov 23, 2026
* Remove const specifier from key in DistanceMap = std::map
* Use cross-platform <cstddef> instead of <types.h>

Signed-off-by: Dhruv Patel <[email protected]>
(cherry picked from commit c639959)
idesign0 added a commit to idesign0/id_moveit2 that referenced this pull request Nov 30, 2026
The only conflict was collision_common.hpp's DistanceMap key: our a87d862/bcb5c49b4
and upstream's aa64747 (moveit#3548, ours) both drop the const from the
std::pair key and differ by one space; upstream's line is taken.

Upstream's 7 new jazzy commits are launch/test Python (moveit#3851, moveit#3777, moveit#3937), the
GIL release in moveit_py (moveit#3935), moveit#3548, and FloatingJointModel::getMaximumExtent()
(moveit#3854: M_PI * 0.5 -> M_PI). The fork's other macOS changes carry over unchanged
(octomap-distribution depend, pilz joint_limits_common links, moveit_py_utils
Python3::Module, fmt::fmt, perception GLEW target + OpenCV, the Apple progress-bar
drawing fix, urdf_config fmt/ranges.h).

Not compile-tested locally: none of our lines changed in this merge, and the upstream
C++ it brings in is a one-constant change in floating_joint_model.cpp plus the
moveit_py GIL release; the jazzy layered build is the check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-jazzy Mergify label that triggers a PR backport to Jazzy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants