Functions: support hashing MFDataType and CPPType

This commit is contained in:
Jacques Lucke 2020-07-08 17:04:09 +02:00
parent 2de5de57c5
commit 05365d1376
2 changed files with 11 additions and 0 deletions

View File

@ -66,6 +66,7 @@
* pointers to virtual member functions.
*/
#include "BLI_hash.hh"
#include "BLI_index_mask.hh"
#include "BLI_math_base.h"
#include "BLI_string_ref.hh"
@ -481,6 +482,11 @@ class CPPType {
return default_value_;
}
uint32_t hash() const
{
return DefaultHash<const CPPType *>{}(this);
}
/**
* Two types only compare equal when their pointer is equal. No two instances of CPPType for the
* same C++ type should be created.

View File

@ -108,6 +108,11 @@ class MFDataType {
BLI_assert(false);
return "";
}
uint hash() const
{
return DefaultHash<CPPType>{}(*type_) + (uint32_t)category_;
}
};
inline bool operator==(const MFDataType &a, const MFDataType &b)