Skip to content

Commit

Permalink
Stop using std::binary_function, deprecated since C++11
Browse files Browse the repository at this point in the history
fix many warnings like:
[   23s] ./../../libycp/src/include/ycp/ycpless.h:35:30: warning: 'template<class _Arg1, class _Arg2, class _Result> struct std::binary_function' is deprecated [-Wdeprecated-declarations]
  • Loading branch information
mvidner committed Jan 20, 2025
1 parent 3f9db76 commit e9308e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
4 changes: 3 additions & 1 deletion libycp/src/YCPList.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "ycp/y2log.h"
#include "ycp/YCPList.h"
#include <algorithm>
#include <functional>
#include "ycp/Bytecode.h"
#include "ycp/Xmlcode.h"
#include "ycp/YCPCodeCompare.h"
Expand Down Expand Up @@ -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();
}


Expand Down
6 changes: 3 additions & 3 deletions libycp/src/include/ycp/YCPCodeCompare.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* "sort (`a, `b, l, ``( a[0] < b[0] ))"
* Passed to std::sort
*/
class YCPCodeCompare : public std::binary_function <const YCPValue &, const YCPValue &, bool>
class YCPCodeCompare
{
private:
SymbolEntryPtr se1;
Expand All @@ -44,8 +44,8 @@ class YCPCodeCompare : public std::binary_function <const YCPValue &, const YCPV
{
}

result_type operator () (first_argument_type a,
second_argument_type b)
bool operator () (const YCPValue & a,
const YCPValue & b)
{
se1->setValue (a);
se2->setValue (b);
Expand Down
6 changes: 3 additions & 3 deletions libycp/src/include/ycp/ycpless.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<YCPValue, YCPValue, bool>
class ycp_less
{

public:
Expand All @@ -57,7 +57,7 @@ class ycp_less : public std::binary_function<YCPValue, YCPValue, bool>
* 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<YCPValue, YCPValue, bool>
class ycp_equal_to
{

public:
Expand All @@ -82,7 +82,7 @@ class ycp_equal_to : public std::binary_function<YCPValue, YCPValue, bool>
* 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<YCPValue, YCPValue, bool>
class ycp_not_equal_to
{

public:
Expand Down
1 change: 1 addition & 0 deletions package/yast2-core.changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Mon Jan 20 10:41:17 UTC 2025 - Martin Vidner <[email protected]>

- 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.

-------------------------------------------------------------------
Expand Down

0 comments on commit e9308e8

Please sign in to comment.