Fix build issues with deprecated functions in C++17 #1468
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR fixes build errors encountered when compiling Essentia with C++17 due to the removal of functions deprecated in C++11 (std::bind1st, std::binary_function). These deprecated functions have been replaced by the recommended alternatives (std::bind with placeholders and direct implementation without inheriting from std::binary_function).
Motivation
Ensures compatibility and successful compilation with modern C++ standards (C++17 and newer), improving maintainability and future-proofing the codebase.
Related Issues and Pull Requests
std::binary_function
in C++17.Solution
Inspired by the work of @wo80 in commit c98daf9, this PR updates the codebase by:
std::binary_function
, which was deprecated in C++11 and removed in C++17.std::bind1st
withstd::bind
using placeholders (std::placeholders::_1
).These changes align with the ongoing efforts to modernize the build system, as discussed in Issue #1398, which focuses on migrating to CMake and enhancing compatibility with newer toolchains.
Testing
The updates have been tested using the lightweight Waf (with the
--std=c++17
flag) build system with the following configuration:Testing was conducted on an Apple Silicon M1 system running macOS Sonoma 14.7.3.
Notes: