From 9bf25b8feb39053ee029b996595c57e06a44b6c3 Mon Sep 17 00:00:00 2001 From: vsonnier Date: Sun, 2 Jun 2019 18:56:00 +0200 Subject: [PATCH] Fix #739: removed usage of std::binary_function deprecated after C++11 --- src/BookmarkMgr.cpp | 4 ++-- src/BookmarkMgr.h | 17 ----------------- src/IOThread.h | 2 +- src/util/DataTree.h | 10 +--------- 4 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/BookmarkMgr.cpp b/src/BookmarkMgr.cpp index a9db129..8d94126 100644 --- a/src/BookmarkMgr.cpp +++ b/src/BookmarkMgr.cpp @@ -389,7 +389,7 @@ BookmarkList BookmarkMgr::getBookmarks(std::string group) { } if (!bmDataSorted[group]) { - std::sort(bmData[group].begin(), bmData[group].end(), BookmarkEntryCompare()); + std::sort(bmData[group].begin(), bmData[group].end(), [](const BookmarkEntryPtr a, const BookmarkEntryPtr b) -> bool { return a->frequency < b->frequency;}); bmDataSorted[group] = true; } @@ -538,7 +538,7 @@ BookmarkRangeList BookmarkMgr::getRanges() { std::lock_guard < std::recursive_mutex > lock(busy_lock); if (!rangesSorted) { - std::sort(ranges.begin(), ranges.end(), BookmarkRangeEntryCompare()); + std::sort(ranges.begin(), ranges.end(), [](const BookmarkRangeEntryPtr a, const BookmarkRangeEntryPtr b) -> bool { return a->freq < b->freq;}); rangesSorted = true; } diff --git a/src/BookmarkMgr.h b/src/BookmarkMgr.h index 4a96777..d64dba8 100644 --- a/src/BookmarkMgr.h +++ b/src/BookmarkMgr.h @@ -48,23 +48,6 @@ public: typedef std::shared_ptr BookmarkEntryPtr; typedef std::shared_ptr BookmarkRangeEntryPtr; -struct BookmarkEntryCompare : public std::binary_function -{ - bool operator()(const BookmarkEntryPtr a, BookmarkEntryPtr b) const - { - return a->frequency < b->frequency; - } -}; - - -struct BookmarkRangeEntryCompare : public std::binary_function -{ - bool operator()(const BookmarkRangeEntryPtr a, BookmarkRangeEntryPtr b) const - { - return a->freq < b->freq; - } -}; - typedef std::vector BookmarkList; typedef std::vector BookmarkRangeList; typedef std::map BookmarkMap; diff --git a/src/IOThread.h b/src/IOThread.h index fc5a570..39b00a3 100644 --- a/src/IOThread.h +++ b/src/IOThread.h @@ -17,7 +17,7 @@ #include "Timer.h" #include "SpinMutex.h" -struct map_string_less : public std::binary_function +struct map_string_less { bool operator()(const std::string& a,const std::string& b) const { diff --git a/src/util/DataTree.h b/src/util/DataTree.h index c27e7a9..b99195e 100755 --- a/src/util/DataTree.h +++ b/src/util/DataTree.h @@ -37,7 +37,7 @@ using namespace std; /* map comparison function */ -struct string_less : public std::binary_function +struct string_less { bool operator()(const std::string& a,const std::string& b) const { @@ -45,14 +45,6 @@ struct string_less : public std::binary_function } }; -/* int comparison function */ -struct int_less : public std::binary_function -{ - bool operator()(int a,int b) const - { - return a < b; - } -}; /* Data Exceptions */