mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-21 13:35:45 +00:00
Add --gen-absl-hash option to generate AbslHashValue for structs. (#8868)
This commit is contained in:
@@ -712,6 +712,10 @@ inline bool operator!=(const Test &lhs, const Test &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
inline H AbslHashValue(H h, const Test &obj) {
|
||||
return H::combine(std::move(h), obj.a(), obj.b());
|
||||
}
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Vec3 FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
@@ -810,6 +814,10 @@ inline bool operator!=(const Vec3 &lhs, const Vec3 &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
inline H AbslHashValue(H h, const Vec3 &obj) {
|
||||
return H::combine(std::move(h), obj.x(), obj.y(), obj.z(), obj.test1(), obj.test2(), obj.test3());
|
||||
}
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) Ability FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
@@ -859,6 +867,10 @@ inline bool operator!=(const Ability &lhs, const Ability &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
inline H AbslHashValue(H h, const Ability &obj) {
|
||||
return H::combine(std::move(h), obj.id(), obj.distance());
|
||||
}
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructs FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
@@ -912,6 +924,10 @@ inline bool operator!=(const StructOfStructs &lhs, const StructOfStructs &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
inline H AbslHashValue(H h, const StructOfStructs &obj) {
|
||||
return H::combine(std::move(h), obj.a(), obj.b(), obj.c());
|
||||
}
|
||||
|
||||
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(4) StructOfStructsOfStructs FLATBUFFERS_FINAL_CLASS {
|
||||
private:
|
||||
@@ -945,6 +961,10 @@ inline bool operator!=(const StructOfStructsOfStructs &lhs, const StructOfStruct
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <typename H>
|
||||
inline H AbslHashValue(H h, const StructOfStructsOfStructs &obj) {
|
||||
return H::combine(std::move(h), obj.a());
|
||||
}
|
||||
|
||||
} // namespace Example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user