Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POSSIBLY REDUNDANT] Cxx17 compatibility fixes for the Rosetta fork of RDKit. #3

Open
wants to merge 2 commits into
base: Rosetta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Code/DataStructs/MultiFPBReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ std::uint8_t *bitsetToBytes(const boost::dynamic_bitset<> &bitset);

namespace {
struct tplSorter
: public std::binary_function<MultiFPBReader::ResultTuple,
MultiFPBReader::ResultTuple, bool> {
: public std::function<bool(MultiFPBReader::ResultTuple, /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
MultiFPBReader::ResultTuple)> {
bool operator()(const MultiFPBReader::ResultTuple &v1,
const MultiFPBReader::ResultTuple &v2) const {
if (v1.get<0>() == v2.get<0>()) {
Expand All @@ -45,8 +45,8 @@ struct tplSorter
}
};
struct pairSorter
: public std::binary_function<std::pair<unsigned int, unsigned int>,
std::pair<unsigned int, unsigned int>, bool> {
: public std::function<bool(std::pair<unsigned int, unsigned int>, /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
std::pair<unsigned int, unsigned int>)> {
bool operator()(const std::pair<unsigned int, unsigned int> &v1,
const std::pair<unsigned int, unsigned int> &v2) const {
if (v1.first == v2.first) {
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/Canon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ bool chiralAtomNeedsTagInversion(const RDKit::ROMol &mol,
}

struct _possibleCompare
: public std::binary_function<PossibleType, PossibleType, bool> {
: public std::function<bool(PossibleType, PossibleType)> { /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
bool operator()(const PossibleType &arg1, const PossibleType &arg2) const {
return (arg1.get<0>() < arg2.get<0>());
}
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/DistGeomHelpers/BoundsMatrixBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ void _setRingAngle(Atom::HybridizationType aHyb, unsigned int ringSize,
}
}

struct lessVector : public std::binary_function<INT_VECT, INT_VECT, bool> {
struct lessVector : public std::function<bool( INT_VECT, INT_VECT )> { /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
bool operator()(const INT_VECT &v1, const INT_VECT &v2) const {
return v1.size() < v2.size();
}
Expand Down
2 changes: 1 addition & 1 deletion Code/GraphMol/FindRings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void findSSSRforDupCands(const ROMol &mol, VECT_INT_VECT &res,
} // end of loop over all set of duplicate candidates
}

struct compRingSize : public std::binary_function<INT_VECT, INT_VECT, bool> {
struct compRingSize : public std::function<bool(INT_VECT, INT_VECT)> { /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
bool operator()(const INT_VECT &v1, const INT_VECT &v2) const {
return v1.size() < v2.size();
}
Expand Down
8 changes: 4 additions & 4 deletions Code/RDGeneral/Ranking.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Rankers {
// compared.
template <typename T1, typename T2>
struct pairGreater
: public std::binary_function<std::pair<T1, T2>, std::pair<T1, T2>, bool> {
: public std::function<bool( std::pair<T1, T2>, std::pair<T1, T2>) > { /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
bool operator()(const std::pair<T1, T2> &v1,
const std::pair<T1, T2> &v2) const {
return v1.first > v2.first;
Expand All @@ -39,17 +39,17 @@ struct pairGreater
// compared.
template <typename T1, typename T2>
struct pairLess
: public std::binary_function<std::pair<T1, T2>, std::pair<T1, T2>, bool> {
: public std::function<bool( std::pair<T1, T2>, std::pair<T1, T2> ) > { /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
bool operator()(const std::pair<T1, T2> &v1,
const std::pair<T1, T2> &v2) const {
return v1.first < v2.first;
}
};

template <typename T>
class argless : public std::binary_function<T, T, bool> {
class argless : public std::function<bool( T, T ) > { /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
public:
argless(const T &c) : std::binary_function<T, T, bool>(), container(c){};
argless(const T &c) : std::function<bool( T, T )>(), container(c){}; /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
bool operator()(unsigned int v1, unsigned int v2) const {
return container[v1] < container[v2];
}
Expand Down
10 changes: 5 additions & 5 deletions Code/RDGeneral/hash/extensions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace gboost
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)

template <class T> struct hash
: std::unary_function<T, std::hash_result_t>
: std::function<std::hash_result_t(T)> /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
{
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
std::hash_result_t operator()(T const& val) const
Expand All @@ -83,7 +83,7 @@ namespace gboost

#if BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T, unsigned int n> struct hash<T[n]>
: std::unary_function<T[n], std::hash_result_t>
: std::function<std::hash_result_t(T[n])> /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
{
std::hash_result_t operator()(const T* val) const
{
Expand All @@ -110,7 +110,7 @@ namespace gboost
{
template <class T>
struct inner
: std::unary_function<T, std::hash_result_t>
: std::function<std::hash_result_t(T)> /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
{
#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
std::hash_result_t operator()(T const& val) const
Expand All @@ -136,7 +136,7 @@ namespace gboost
{
template <class T>
struct inner
: public std::unary_function<T, std::hash_result_t>
: public std::function<std::hash_result_t(T)> /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
{
std::hash_result_t operator()(T const& val) const
{
Expand All @@ -155,7 +155,7 @@ namespace gboost
{
template <class T>
struct inner
: public std::unary_function<T, std::hash_result_t>
: public std::function<std::hash_result_t(T)> /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
{
std::hash_result_t operator()(T& val) const
{
Expand Down
22 changes: 14 additions & 8 deletions Code/RDGeneral/hash/hash.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,29 +372,34 @@ namespace gboost
//

#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300)

/*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
#define BOOST_HASH_SPECIALIZE(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::hash_result_t> \
: public std::function<std::hash_result_t(type)> \
{ \
std::hash_result_t operator()(type v) const \
{ \
return gboost::hash_value(v); \
} \
};

/*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
#define BOOST_HASH_SPECIALIZE_REF(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::hash_result_t> \
: public std::function<std::hash_result_t(type)> \
{ \
std::hash_result_t operator()(type const& v) const \
{ \
return gboost::hash_value(v); \
} \
};
#else

/*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
#define BOOST_HASH_SPECIALIZE(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::hash_result_t> \
: public std::function<std::hash_result_t(type)> \
{ \
std::hash_result_t operator()(type v) const \
{ \
Expand All @@ -403,17 +408,18 @@ namespace gboost
}; \
\
template <> struct hash<const type> \
: public std::unary_function<const type, std::hash_result_t> \
: public std::function<std::hash_result_t(const type)> \
{ \
std::hash_result_t operator()(const type v) const \
{ \
return gboost::hash_value(v); \
} \
};

/*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
#define BOOST_HASH_SPECIALIZE_REF(type) \
template <> struct hash<type> \
: public std::unary_function<type, std::hash_result_t> \
: public std::function<std::hash_result_t(type)> \
{ \
std::hash_result_t operator()(type const& v) const \
{ \
Expand All @@ -422,7 +428,7 @@ namespace gboost
}; \
\
template <> struct hash<const type> \
: public std::unary_function<const type, std::hash_result_t> \
: public std::function<std::hash_result_t(const type)> \
{ \
std::hash_result_t operator()(type const& v) const \
{ \
Expand Down Expand Up @@ -455,7 +461,7 @@ namespace gboost
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template <class T>
struct hash<T*>
: public std::unary_function<T*, std::hash_result_t>
: public std::function<std::hash_result_t(T*)> /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
{
std::hash_result_t operator()(T* v) const
{
Expand All @@ -480,7 +486,7 @@ namespace gboost
{
template <class T>
struct inner
: public std::unary_function<T, std::hash_result_t>
: public std::function<std::hash_result_t(T)> /*Modified for Rosetta CXX17 compatibility. Resolve merge conflicts in favour of the primary RDKit repository. VKM, 24 May 2024.*/
{
std::hash_result_t operator()(T val) const
{
Expand Down