Skip to content

Conversation

@nyibbang
Copy link
Contributor

@nyibbang nyibbang commented Jan 19, 2026

Summary

This change completely removes the any contrib library and replaces its use with std::any available in C++17.

Motivation

This change has several benefits:

  • It removes code from the project and uses the standard version instead.
  • It removes a warning about a deprecated use of std::aligned_storage when compiling a project using the library in C++23 or more.

Impact on API

This change removes a header and replaces uses of linb::any with std::any in safe_any.hpp. In theory, if contrib/any.hpp is considered an implementation details of BT::Any then this should not be considered an API break as the interface of the class does not change.

Summary by CodeRabbit

Release Notes

  • Refactor
    • Updated internal dependencies to use standard library components, improving code maintainability and reducing custom implementation overhead while maintaining full backward compatibility.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 19, 2026

📝 Walkthrough

Walkthrough

The pull request removes a custom C++11-compatible any implementation (linb::any) from the contrib directory and migrates the BT::Any class to use the standard library's std::any, eliminating custom type-erasure machinery and external dependencies.

Changes

Cohort / File(s) Summary
Removal of custom any implementation
include/behaviortree_cpp/contrib/any.hpp
Complete file deletion (557 lines). Removes linb::any class, linb::bad_any_cast exception, in_place_type_t utilities, any_cast overloads, swap function, make_any helpers, internal VTable system, and type erasure logic.
Migration to std::any
include/behaviortree_cpp/utils/safe_any.hpp
Replaced internal storage _any from linb::any to std::any. Updated all linb::any_cast calls to std::any_cast. Changed empty() method to use !_any.has_value() instead of _any.empty(). Modified constructor conversions, stringToNumber, enum/arithmetic handlers, and tryCast to operate on std::any. Added #include and removed contrib/any.hpp dependency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


🐰 Out with the old, in with the new,
Custom any code bids adieu,
std::any takes its rightful place,
Standard library saves the day with grace,
Simpler, cleaner, no more strife!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly describes the main change: removing the any contrib library.
Description check ✅ Passed The description provides summary, motivation, and API impact analysis, but lacks discussion of testing strategy and other PR template sections.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@facontidavide
Copy link
Collaborator

facontidavide commented Jan 19, 2026

Thanks but this will probably affect the ABI and I will not do it.

Additionally, the implementation I use has a guaranteed 16 bytes small object optimization and I rely on that

image

@nyibbang
Copy link
Contributor Author

Fair enough, would you be open to a PR to remove the use of aligned_storage in that case ?

@nyibbang nyibbang closed this Jan 19, 2026
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.

2 participants