From e9308e8655c634bcc1da865f578353cdf90f851d Mon Sep 17 00:00:00 2001 From: Martin Vidner Date: Mon, 20 Jan 2025 11:54:48 +0100 Subject: [PATCH] Stop using std::binary_function, deprecated since C++11 fix many warnings like: [ 23s] ./../../libycp/src/include/ycp/ycpless.h:35:30: warning: 'template struct std::binary_function' is deprecated [-Wdeprecated-declarations] --- libycp/src/YCPList.cc | 4 +++- libycp/src/include/ycp/YCPCodeCompare.h | 6 +++--- libycp/src/include/ycp/ycpless.h | 6 +++--- package/yast2-core.changes | 1 + 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/libycp/src/YCPList.cc b/libycp/src/YCPList.cc index b63738355..7dec976b5 100644 --- a/libycp/src/YCPList.cc +++ b/libycp/src/YCPList.cc @@ -23,6 +23,7 @@ #include "ycp/y2log.h" #include "ycp/YCPList.h" #include +#include #include "ycp/Bytecode.h" #include "ycp/Xmlcode.h" #include "ycp/YCPCodeCompare.h" @@ -115,7 +116,8 @@ YCPListRep::swap (int x, int y) bool YCPListRep::contains (const YCPValue& value) const { - return find_if(begin(), end(), bind2nd(ycp_equal_to(), value)) != end(); + using namespace std::placeholders; + return find_if(begin(), end(), std::bind(ycp_equal_to(), _1, value)) != end(); } diff --git a/libycp/src/include/ycp/YCPCodeCompare.h b/libycp/src/include/ycp/YCPCodeCompare.h index 922610ad1..f13049ea1 100644 --- a/libycp/src/include/ycp/YCPCodeCompare.h +++ b/libycp/src/include/ycp/YCPCodeCompare.h @@ -28,7 +28,7 @@ * "sort (`a, `b, l, ``( a[0] < b[0] ))" * Passed to std::sort */ -class YCPCodeCompare : public std::binary_function +class YCPCodeCompare { private: SymbolEntryPtr se1; @@ -44,8 +44,8 @@ class YCPCodeCompare : public std::binary_function setValue (a); se2->setValue (b); diff --git a/libycp/src/include/ycp/ycpless.h b/libycp/src/include/ycp/ycpless.h index b4010419e..f36a749b3 100644 --- a/libycp/src/include/ycp/ycpless.h +++ b/libycp/src/include/ycp/ycpless.h @@ -32,7 +32,7 @@ * Compares two YCPValues and returns true if the first value is less than the * second one, false otherwise. Optionally the comparison is locale aware. */ -class ycp_less : public std::binary_function +class ycp_less { public: @@ -57,7 +57,7 @@ class ycp_less : public std::binary_function * Compares two YCPValues and returns true if they are equal, false otherwise. * Optionally the comparison is locale aware. */ -class ycp_equal_to : public std::binary_function +class ycp_equal_to { public: @@ -82,7 +82,7 @@ class ycp_equal_to : public std::binary_function * Compares two YCPValues and returns true if they are not equal, false * otherwise. Optionally the comparison is locale aware. */ -class ycp_not_equal_to : public std::binary_function +class ycp_not_equal_to { public: diff --git a/package/yast2-core.changes b/package/yast2-core.changes index 18c16c677..b939db9c8 100644 --- a/package/yast2-core.changes +++ b/package/yast2-core.changes @@ -3,6 +3,7 @@ Mon Jan 20 10:41:17 UTC 2025 - Martin Vidner - adjust testsuite to pass also with newer coreutils-9.6 (gh#yast/yast-core#167) +- Stop using std::binary_function, deprecated since C++11 - 5.0.3. -------------------------------------------------------------------