Functions: support hashing MFDataType and CPPType
This commit is contained in:
parent
2de5de57c5
commit
05365d1376
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue