diff options
author | Jacques Lucke <mail@jlucke.com> | 2019-09-14 13:11:14 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2019-09-14 13:11:14 +0300 |
commit | 79e1165bd7488850e896112c2b0f8bf1e6b25db9 (patch) | |
tree | 1cb20163e2aaff754e295360457b1f15428eca25 /source/blender/blenlib/BLI_hash_cxx.h | |
parent | ca76ecfa0ee1153677d8c89149000c7e9a5814d6 (diff) |
BLI: Improve forwarding semantics of some data structures
This makes it possible to use e.g. `std::unique_ptr` in a map.
Diffstat (limited to 'source/blender/blenlib/BLI_hash_cxx.h')
-rw-r--r-- | source/blender/blenlib/BLI_hash_cxx.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_hash_cxx.h b/source/blender/blenlib/BLI_hash_cxx.h index 78b8ee20b0c..8e7d498a4c8 100644 --- a/source/blender/blenlib/BLI_hash_cxx.h +++ b/source/blender/blenlib/BLI_hash_cxx.h @@ -89,6 +89,13 @@ template<typename T> struct DefaultHash<T *> { } }; +template<typename T> struct DefaultHash<std::unique_ptr<T>> { + uint32_t operator()(const std::unique_ptr<T> &value) const + { + return DefaultHash<T *>{}(value.get()); + } +}; + template<typename T1, typename T2> struct DefaultHash<std::pair<T1, T2>> { uint32_t operator()(const std::pair<T1, T2> &value) const { |