Add virtual destructors
Summary: Virtual destructors were missing in classes/structs which can be inherited. A missing virtual destructor gives undefined behaviour when deleting derived class using base type. Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1117
This commit is contained in:
parent
f0156955f0
commit
07d262cd1e
@ -16,6 +16,7 @@ class Common : public TotalOrdering<TSpecificType> {
|
||||
|
||||
Common() {}
|
||||
explicit Common(const StorageT storage) : storage_(storage) {}
|
||||
virtual ~Common() {}
|
||||
|
||||
friend bool operator==(const TSpecificType &a, const TSpecificType &b) {
|
||||
return a.storage_ == b.storage_;
|
||||
|
@ -11,6 +11,8 @@
|
||||
*/
|
||||
template <typename TLhs, typename TRhs = TLhs, typename TReturn = bool>
|
||||
struct TotalOrdering {
|
||||
virtual ~TotalOrdering() {}
|
||||
|
||||
friend constexpr TReturn operator!=(const TLhs& a, const TRhs& b) {
|
||||
return !(a == b);
|
||||
}
|
||||
@ -30,6 +32,8 @@ struct TotalOrdering {
|
||||
|
||||
template <class Derived, class T>
|
||||
struct TotalOrderingWith {
|
||||
virtual ~TotalOrderingWith() {}
|
||||
|
||||
friend constexpr bool operator!=(const Derived& a, const T& b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user