Move to C++17 (#5155)

* bump to c++17

* remove binary_function

* update our boost::hash implementation too
This commit is contained in:
Greg Landrum
2022-04-12 13:53:07 +02:00
committed by GitHub
parent 3b2916c9a4
commit 939d8c3c02
12 changed files with 109 additions and 127 deletions

View File

@@ -28,32 +28,24 @@ std::uint8_t *bitsetToBytes(const boost::dynamic_bitset<> &bitset);
}
namespace {
struct tplSorter
: public std::binary_function<MultiFPBReader::ResultTuple,
MultiFPBReader::ResultTuple, bool> {
bool operator()(const MultiFPBReader::ResultTuple &v1,
const MultiFPBReader::ResultTuple &v2) const {
if (v1.get<0>() == v2.get<0>()) {
if (v1.get<2>() == v2.get<2>()) {
return v1.get<1>() < v2.get<1>();
} else {
return v1.get<2>() < v2.get<2>();
}
auto tplSorter = [](const MultiFPBReader::ResultTuple &v1,
const MultiFPBReader::ResultTuple &v2) {
if (v1.get<0>() == v2.get<0>()) {
if (v1.get<2>() == v2.get<2>()) {
return v1.get<1>() < v2.get<1>();
} else {
return v1.get<0>() > v2.get<0>();
return v1.get<2>() < v2.get<2>();
}
} else {
return v1.get<0>() > v2.get<0>();
}
};
struct pairSorter
: public std::binary_function<std::pair<unsigned int, unsigned int>,
std::pair<unsigned int, unsigned int>, bool> {
bool operator()(const std::pair<unsigned int, unsigned int> &v1,
const std::pair<unsigned int, unsigned int> &v2) const {
if (v1.first == v2.first) {
return v1.second < v2.second;
} else {
return v1.first < v2.first;
}
auto pairSorter = [](const auto &v1, const auto &v2) {
if (v1.first == v2.first) {
return v1.second < v2.second;
} else {
return v1.first < v2.first;
}
};
@@ -133,7 +125,7 @@ void generic_nbr_helper(std::vector<MultiFPBReader::ResultTuple> &res, T func,
res.reserve(res.size() + (*args.res).size());
res.insert(res.end(), (*args.res)[i].begin(), (*args.res)[i].end());
}
std::sort(res.begin(), res.end(), tplSorter());
std::sort(res.begin(), res.end(), tplSorter);
}
void get_tani_nbrs(const std::vector<FPBReader *> &d_readers,
const std::uint8_t *bv, double threshold,
@@ -202,7 +194,7 @@ void get_containing_nbrs(
}
}
std::sort(res.begin(), res.end(), pairSorter());
std::sort(res.begin(), res.end(), pairSorter);
}
} // end of anonymous namespace