From 5f7f48be9b8227e94a637a45c46e208fd2fe0343 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Fri, 23 Sep 2022 09:05:32 -0700 Subject: [PATCH] [equatable] update `Equatable` to ensure CRTP-style use (#8199) This commit updates `Equatable` to ensure CRTP-style use. --- src/core/common/equatable.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/common/equatable.hpp b/src/core/common/equatable.hpp index 06fdda993..d9130150f 100644 --- a/src/core/common/equatable.hpp +++ b/src/core/common/equatable.hpp @@ -87,7 +87,10 @@ public: * @retval FALSE If the two `Type` instances are not equal. * */ - bool operator==(const Type &aOther) const { return memcmp(this, &aOther, sizeof(Type)) == 0; } + bool operator==(const Type &aOther) const + { + return memcmp(static_cast(this), &aOther, sizeof(Type)) == 0; + } }; } // namespace ot