Skip to content

Commit 3162cd7

Browse files
committed
Removed C++11 deprecated functions std::binary_function and std::bind1st
- `std::binary_function` is deprecated in C++11 and removed in C++17: https://en.cppreference.com/w/cpp/utility/functional/binary_function - `std::binary_function` is deprecated in C++11 and removed in C++17: https://en.cppreference.com/w/cpp/utility/functional/bind12
1 parent 0a8850d commit 3162cd7

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

Diff for: src/algorithms/highlevel/chromaprinter.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void Chromaprinter::compute() {
5454
// Copy the signal to new vector to expand it to the int16_t dynamic range before the cast.
5555
std::vector<Real> signalScaled = signal;
5656
std::transform(signalScaled.begin(), signalScaled.end(), signalScaled.begin(),
57-
std::bind1st(std::multiplies<Real>(), pow(2,15)));
57+
std::bind(std::multiplies<Real>(), pow(2,15), std::placeholders::_1));
5858

5959
std::vector<int16_t> signalCast(signalScaled.begin(), signalScaled.end());
6060

@@ -160,7 +160,7 @@ AlgorithmStatus Chromaprinter::process() {
160160
// Copy the signal to new vector to expand it to the int16_t dynamic range before the cast.
161161
std::vector<Real> signalScaled = signal;
162162
std::transform(signalScaled.begin(), signalScaled.end(), signalScaled.begin(),
163-
std::bind1st(std::multiplies<Real>(), pow(2,15)));
163+
std::bind(std::multiplies<Real>(), pow(2,15), std::placeholders::_1));
164164

165165
std::vector<int16_t> signalCast(signalScaled.begin(), signalScaled.end());
166166

Diff for: src/essentia/essentiamath.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ std::vector<T> derivative(const std::vector<T>& array) {
914914
}
915915

916916
template<typename T, typename U, typename Comparator=std::greater<T> >
917-
class PairCompare : public std::binary_function<T, U, bool> {
917+
class PairCompare {
918918
Comparator _cmp;
919919
public:
920920
bool operator () (const std::pair<T,U>& p1, const std::pair<T,U>& p2) const {

Diff for: src/essentia/types.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ inline bool case_insensitive_char_cmp(char a, char b) {
115115
/**
116116
* Function object for comparing two strings in a case-insensitive manner.
117117
*/
118-
struct case_insensitive_str_cmp
119-
: public std::binary_function<const std::string&, const std::string&, bool> {
118+
struct case_insensitive_str_cmp {
120119
bool operator()(const std::string& str1, const std::string& str2) const {
121120
return std::lexicographical_compare(str1.begin(), str1.end(),
122121
str2.begin(), str2.end(),

Diff for: src/essentia/utils/peak.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Peak {
7171
// the positions are equal it sorts by descending magnitude
7272
template<typename Comp1=std::less<Real>,
7373
typename Comp2=std::greater_equal<Real> >
74-
class ComparePeakPosition : public std::binary_function<Real, Real, bool> {
74+
class ComparePeakPosition {
7575
Comp1 _cmp1;
7676
Comp2 _cmp2;
7777
public:
@@ -86,7 +86,7 @@ class ComparePeakPosition : public std::binary_function<Real, Real, bool> {
8686
// the magnitudes are equal it sorts by ascending position
8787
template<typename Comp1=std::greater<Real>,
8888
typename Comp2=std::less_equal<Real> >
89-
class ComparePeakMagnitude : public std::binary_function<Real, Real, bool> {
89+
class ComparePeakMagnitude {
9090
Comp1 _cmp1;
9191
Comp2 _cmp2;
9292
public:

0 commit comments

Comments
 (0)