Fix operator==() generated for field of fixed sized array (#7749)

* Fix operator==() generated for field of fixed sized array

* Compare address

* noexcept

* Grammer

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Saman
2023-01-06 12:11:11 +08:00
committed by GitHub
parent 07d9485146
commit 74b5195089
5 changed files with 69 additions and 9 deletions

View File

@@ -141,10 +141,10 @@ FLATBUFFERS_STRUCT_END(NestedStruct, 32);
inline bool operator==(const NestedStruct &lhs, const NestedStruct &rhs) {
return
(lhs.a() == rhs.a()) &&
(*lhs.a() == *rhs.a()) &&
(lhs.b() == rhs.b()) &&
(lhs.c() == rhs.c()) &&
(lhs.d() == rhs.d());
(*lhs.c() == *rhs.c()) &&
(*lhs.d() == *rhs.d());
}
inline bool operator!=(const NestedStruct &lhs, const NestedStruct &rhs) {
@@ -257,11 +257,11 @@ FLATBUFFERS_STRUCT_END(ArrayStruct, 160);
inline bool operator==(const ArrayStruct &lhs, const ArrayStruct &rhs) {
return
(lhs.a() == rhs.a()) &&
(lhs.b() == rhs.b()) &&
(*lhs.b() == *rhs.b()) &&
(lhs.c() == rhs.c()) &&
(lhs.d() == rhs.d()) &&
(*lhs.d() == *rhs.d()) &&
(lhs.e() == rhs.e()) &&
(lhs.f() == rhs.f());
(*lhs.f() == *rhs.f());
}
inline bool operator!=(const ArrayStruct &lhs, const ArrayStruct &rhs) {