Skip to content

Replace more boost by std functions - #1762

Open
pecalvop wants to merge 19 commits into
masterfrom
1749-remove-boost-from-old-opal
Open

Replace more boost by std functions#1762
pecalvop wants to merge 19 commits into
masterfrom
1749-remove-boost-from-old-opal

Conversation

@pecalvop

@pecalvop pecalvop commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Part of #1727

I've put each boost replacement in a separate commit to make it easier to track.

Overview

This pull request continues the removal of Boost dependencies from the legacy OPAL codebase.

The remaining Boost functionality is replaced with equivalent C++ standard library functionality or, where no direct standard-library replacement is available, with small self-contained implementations.

The main objectives are to:

  • reduce external dependencies;
  • simplify the build configuration;
  • reduce Boost library linking requirements;
  • modernize the legacy code;
  • move the codebase towards standard C++ functionality.

Main changes

Boost iostreams

Boost iostreams dependencies have been removed where standard C++ streams provide the required functionality.

String algorithms

Boost string algorithms have been replaced with standard C++ facilities.

In particular, boost::ilexicographical_compare is replaced using:

  • std::lexicographical_compare
  • std::tolower

This preserves the case-insensitive lexical comparison while removing the dependency on Boost string algorithms.

Type information

boost::type_index has been removed in favour of standard C++ type facilities.

Numeric casts

Uses of boost::numeric_cast have been replaced with explicit standard C++ casts, primarily using static_cast.

Chebyshev polynomials

The Boost Chebyshev polynomial functionality has been replaced by a local implementation.

This avoids introducing an additional Boost dependency for a relatively small and specialised numerical operation.

Filesystem

boost::filesystem has been replaced by std::filesystem.

This removes both the Boost filesystem headers and the corresponding Boost library dependency.

Formatting

boost::format has been removed and replaced with standard C++ stream-based formatting or equivalent standard-library functionality.

Timers

The Boost timer dependency has been removed.

The existing IPPL timing infrastructure continues to provide timer creation, measurement, accumulation and reporting without relying on Boost Timer.

The timing output sorting has also been migrated away from Boost string comparison utilities.

Function objects

Remaining uses of boost::function have been replaced with std::function.

This removes another Boost-specific interface in favour of the C++ standard library.

Optimizer parser

The optimizer expression/parser infrastructure has been cleaned up to remove remaining Boost dependencies.

The affected components include:

  • AST handling;
  • expression evaluation;
  • parser infrastructure;
  • function handling;
  • error/skipper handling.

The existing parser functionality is retained while reducing the dependency on Boost.

Serialization

Boost Serialization and Boost Archive dependencies have been removed from the remaining optimizer code.

The affected solution-state and communication code has been adapted so that Boost Serialization is no longer required.

MPI and optimizer communication

The optimizer communication layer has been cleaned up as part of the Boost removal.

Affected components include:

  • MasterNode;
  • SolutionStateIO;
  • MPIHelper;
  • AsyncSendBuffers;
  • optimizer type utilities.

MPI communication is now based on MPI and standard C++ types rather than Boost wrappers.

CMake changes

The Boost component requirements have been reduced accordingly.

Previously, the build configuration required:

filesystem
iostreams
serialization
system
timer

@pecalvop pecalvop self-assigned this Sep 2, 2026
@pecalvop pecalvop added the Cleanup To be used for all changes not changing the "real" source (Comments, white space...) label Sep 2, 2026
@pecalvop
pecalvop marked this pull request as ready for review September 4, 2026 13:05
@pecalvop
pecalvop requested review from aaadelmann and gsell and a lite review from Copilot and removed request for Copilot September 4, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Cleanup To be used for all changes not changing the "real" source (Comments, white space...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants