Remove vtable from TotalOrdering
Summary: This change undoes the performance impact that was introduced in D1117 Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1756
This commit is contained in:
parent
7a8e6b52e0
commit
eabd832048
@ -13,8 +13,10 @@ namespace utils {
|
||||
*/
|
||||
template <typename TLhs, typename TRhs = TLhs, typename TReturn = bool>
|
||||
struct TotalOrdering {
|
||||
virtual ~TotalOrdering() {}
|
||||
protected:
|
||||
~TotalOrdering() {}
|
||||
|
||||
public:
|
||||
friend constexpr TReturn operator!=(const TLhs &a, const TRhs &b) {
|
||||
return !(a == b);
|
||||
}
|
||||
@ -32,41 +34,4 @@ struct TotalOrdering {
|
||||
}
|
||||
};
|
||||
|
||||
template <class Derived, class T>
|
||||
struct TotalOrderingWith {
|
||||
virtual ~TotalOrderingWith() {}
|
||||
|
||||
friend constexpr bool operator!=(const Derived &a, const T &b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
friend constexpr bool operator<=(const Derived &a, const T &b) {
|
||||
return a < b || a == b;
|
||||
}
|
||||
|
||||
friend constexpr bool operator>(const Derived &a, const T &b) {
|
||||
return !(a <= b);
|
||||
}
|
||||
|
||||
friend constexpr bool operator>=(const Derived &a, const T &b) {
|
||||
return !(a < b);
|
||||
}
|
||||
|
||||
friend constexpr bool operator!=(const T &a, const Derived &b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
||||
friend constexpr bool operator<=(const T &a, const Derived &b) {
|
||||
return a < b || a == b;
|
||||
}
|
||||
|
||||
friend constexpr bool operator>(const T &a, const Derived &b) {
|
||||
return !(a <= b);
|
||||
}
|
||||
|
||||
friend constexpr bool operator>=(const T &a, const Derived &b) {
|
||||
return !(a < b);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace utils
|
||||
|
Loading…
Reference in New Issue
Block a user