Skip to content

Remove boost dependencies. #1360

@fruffy

Description

@fruffy

We can likely clean up some dependencies on boost since we have upgraded to C++17. Two easy low-hanging fruits are boost::filesystem and boost::optional.

There is also (as suggested by GPT5.3):

  • Easy win: Boost::thread
    • You’re using Boost shared mutex/locks in core paths (include/bm/bm_sim/.h, src/bm_sim/.cpp), e.g. boost::shared_mutex, boost::shared_lock, boost::unique_lock.
    • In C++17 this can be replaced with std::shared_mutex, std::shared_lock, std::unique_lock (<shared_mutex>, ).
    • That should let you remove Boost::thread from CMake (src/bm_sim/CMakeLists.txt:80) and related autotools checks (configure.ac:251).
  • Medium effort: Boost hash helpers (boost::hash_combine)
    • Used in a few places (include/bm/bm_sim/P4Objects.h:442, src/bm_sim/debugger.cpp:174, include/bm/bm_sim/field_lists.h:125, etc.).
    • C++17 has no std::hash_combine, so you’d replace with a small local helper (common combine formula) and drop <boost/functional/hash.hpp> includes.

The last remaining piece is boost::program_options. I have great experience with CLI11: https://github.com/CLIUtils/CLI11

It's a standalone dependency and can be vendored, which makes it easier to work with.

@matthewtlam Could this be in scope for the GSoC modernization task you have in mind? Otherwise I kick this off myself.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions