Skip to content

Replace Boost with C++ standard library - #74

Open
gretel wants to merge 1 commit into
pothosware:masterfrom
gretel:pr/boost-purge
Open

Replace Boost with C++ standard library#74
gretel wants to merge 1 commit into
pothosware:masterfrom
gretel:pr/boost-purge

Conversation

@gretel

@gretel gretel commented May 1, 2026

Copy link
Copy Markdown
Contributor

Replace Boost with C++ standard library

Changed

  • boost::lexical_cast<double>(s)std::stod(s) (3 sites)
  • boost::lexical_cast<std::string>(n)std::to_string(n) (2 sites)
  • boost::format("...") % a % b → string concatenation with + (8 sites)
  • boost::bind(&fn, target, args...) → C++14 lambdas with explicit captures (51 sites)
  • boost::mutex / scoped_lockstd::mutex / std::lock_guard<std::mutex>
  • boost::uint32_tstd::uint32_t
  • Drop unused <boost/foreach.hpp> and <boost/algorithm/string.hpp>
  • Drop find_package(Boost), Boost link flags, BOOST_ALL_DYN_LINK
  • Add <cstdint>, <mutex>

Why

The Boost utilities replaced here all have C++14 equivalents.

UHD's CMake config still pulls Boost_INCLUDE_DIRS transitively via find_dependency(Boost) in UHDConfig.cmake, so UHD public headers that template-instantiate Boost types (e.g. uhd::dict in dict.ipp) keep compiling.

@gretel
gretel marked this pull request as ready for review May 1, 2026 21:55
@zuckschwerdt

Copy link
Copy Markdown
Member

This seems a very good cleanup to have. Can you rebase? Thanks!

@gretel
gretel force-pushed the pr/boost-purge branch 3 times, most recently from 34d9b71 to 655224c Compare August 10, 2026 19:04
- boost::lexical_cast -> std::stod / std::to_string
- boost::format -> string concatenation
- boost::bind -> C++14 lambdas with explicit captures
- boost::mutex / scoped_lock -> std::mutex / std::lock_guard
- boost::uint32_t -> std::uint32_t
- drop <boost/bind.hpp>, <boost/lexical_cast.hpp>, <boost/weak_ptr.hpp>
- drop find_package(Boost), Boost link flags, and BOOST_ALL_DYN_LINK
- macports CI: pass UHD's boost171 include dir via CMAKE_CXX_FLAGS,
  since MacPorts UHD public headers still include <boost/config.hpp>

Rebased onto current upstream master (UHD 4.x, modernized CMake).
Property-tree publisher/subscriber callbacks use
set_publisher() / add_desired_subscriber() with lambdas, matching
upstream's API surface after the UHD <4.0 support drop.
@gretel

gretel commented Aug 10, 2026

Copy link
Copy Markdown
Contributor Author

@zuckschwerdt the MacPorts job is red because the MacPorts uhd port is still pinned to 3.15.0.0. how would you like to proceed?

@zuckschwerdt

Copy link
Copy Markdown
Member

We'd need to switch to MacPorts uhd-devel (4.4.0.0), right? And possibly notify MacPorts SoapyUHD maintainers of that change.

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