mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 02:39:52 +00:00
[equatable] update Equatable to ensure CRTP-style use (#8199)
This commit updates `Equatable<Type>` to ensure CRTP-style use.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user