Skip to content

Commit

Permalink
Fix #739: removed usage of std::binary_function deprecated after C++11
Browse files Browse the repository at this point in the history
  • Loading branch information
vsonnier committed Jun 2, 2019
1 parent 0fa818c commit 9bf25b8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 29 deletions.
4 changes: 2 additions & 2 deletions src/BookmarkMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
17 changes: 0 additions & 17 deletions src/BookmarkMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,6 @@ class BookmarkRangeEntry {
typedef std::shared_ptr<BookmarkEntry> BookmarkEntryPtr;
typedef std::shared_ptr<BookmarkRangeEntry> BookmarkRangeEntryPtr;

struct BookmarkEntryCompare : public std::binary_function<BookmarkEntryPtr,BookmarkEntryPtr,bool>
{
bool operator()(const BookmarkEntryPtr a, BookmarkEntryPtr b) const
{
return a->frequency < b->frequency;
}
};


struct BookmarkRangeEntryCompare : public std::binary_function<BookmarkRangeEntryPtr ,BookmarkRangeEntryPtr ,bool>
{
bool operator()(const BookmarkRangeEntryPtr a, BookmarkRangeEntryPtr b) const
{
return a->freq < b->freq;
}
};

typedef std::vector<BookmarkEntryPtr> BookmarkList;
typedef std::vector<BookmarkRangeEntryPtr> BookmarkRangeList;
typedef std::map<std::string, BookmarkList > BookmarkMap;
Expand Down
2 changes: 1 addition & 1 deletion src/IOThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include "Timer.h"
#include "SpinMutex.h"

struct map_string_less : public std::binary_function<std::string,std::string,bool>
struct map_string_less
{
bool operator()(const std::string& a,const std::string& b) const
{
Expand Down
10 changes: 1 addition & 9 deletions src/util/DataTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,14 @@ using namespace std;


/* map comparison function */
struct string_less : public std::binary_function<std::string,std::string,bool>
struct string_less
{
bool operator()(const std::string& a,const std::string& b) const
{
return a.compare(b) < 0;
}
};

/* int comparison function */
struct int_less : public std::binary_function<int,int,bool>
{
bool operator()(int a,int b) const
{
return a < b;
}
};


/* Data Exceptions */
Expand Down

0 comments on commit 9bf25b8

Please sign in to comment.