BLI: Add hash function to quaternion type

Just reuse the 4D vector hash.
This allows creating a CPPType for math::Quaternion.
This commit is contained in:
Hans Goudey 2023-06-08 17:42:36 -04:00
parent 04422064fb
commit 65d8cfd82d

View File

@ -162,6 +162,11 @@ template<typename T> struct QuaternionBase {
return (a.w == b.w) && (a.x == b.x) && (a.y == b.y) && (a.z == b.z);
}
uint64_t hash() const
{
return VecBase<T, 4>(*this).hash();
}
friend std::ostream &operator<<(std::ostream &stream, const QuaternionBase &rot)
{
return stream << "Quaternion" << static_cast<VecBase<T, 4>>(rot);