[equatable] update Equatable to ensure CRTP-style use (#8199)

This commit updates `Equatable<Type>` to ensure CRTP-style use.
This commit is contained in:
Abtin Keshavarzian
2022-09-23 09:05:32 -07:00
committed by GitHub
parent 1942a79d75
commit 5f7f48be9b
+4 -1
View File
@@ -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<const Type *>(this), &aOther, sizeof(Type)) == 0;
}
};
} // namespace ot