diff options
author | Julian Eisel <julian@blender.org> | 2020-06-11 12:55:40 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-06-11 12:55:40 +0300 |
commit | 15e6f9012c84c4ebce41bf1928635a3abe046a55 (patch) | |
tree | dfc33ab9de451f2f510ff09eadf8b6eb6fdbf19f /source/blender/blenlib | |
parent | 0b6def7059b6a64b3cef3ba7d4fa46000aee1761 (diff) | |
parent | 95aa8ffed56e7bd1784bab64e82c82c4e855ae48 (diff) |
Merge branch 'master' into asset-uuid
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_hash_tables.hh | 1 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_map.hh | 31 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_set.hh | 2 | ||||
-rw-r--r-- | source/blender/blenlib/BLI_vector_set.hh | 4 |
4 files changed, 22 insertions, 16 deletions
diff --git a/source/blender/blenlib/BLI_hash_tables.hh b/source/blender/blenlib/BLI_hash_tables.hh index b565b396a7a..c3b0b1f90e0 100644 --- a/source/blender/blenlib/BLI_hash_tables.hh +++ b/source/blender/blenlib/BLI_hash_tables.hh @@ -30,6 +30,7 @@ #include "BLI_math_base.h" #include "BLI_memory_utils.hh" #include "BLI_string.h" +#include "BLI_string_ref.hh" #include "BLI_utildefines.h" #include "BLI_vector.hh" diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh index 9737367ebca..4fc9f98d835 100644 --- a/source/blender/blenlib/BLI_map.hh +++ b/source/blender/blenlib/BLI_map.hh @@ -745,6 +745,21 @@ class Map { } }; + struct Item { + const Key &key; + const Value &value; + }; + + struct MutableItem { + const Key &key; + Value &value; + + operator Item() const + { + return Item{key, value}; + } + }; + class ItemIterator final : public BaseIterator<ItemIterator> { public: ItemIterator(const Slot *slots, uint32_t total_slots, uint32_t current_slot) @@ -752,11 +767,6 @@ class Map { { } - struct Item { - const Key &key; - const Value &value; - }; - Item operator*() const { const Slot &slot = this->current_slot(); @@ -771,12 +781,7 @@ class Map { { } - struct Item { - const Key &key; - Value &value; - }; - - Item operator*() const + MutableItem operator*() const { Slot &slot = this->current_slot(); return {*slot.key(), *slot.value()}; @@ -838,7 +843,7 @@ class Map { void print_stats(StringRef name = "") const { HashTableStats stats(*this, this->keys()); - stats.print(); + stats.print(name); } /** @@ -889,7 +894,7 @@ class Map { */ uint32_t size_in_bytes() const { - return sizeof(Slot) * m_slots.size(); + return (uint32_t)(sizeof(Slot) * m_slots.size()); } /** diff --git a/source/blender/blenlib/BLI_set.hh b/source/blender/blenlib/BLI_set.hh index ece9fb05d8c..af0c3424f5a 100644 --- a/source/blender/blenlib/BLI_set.hh +++ b/source/blender/blenlib/BLI_set.hh @@ -410,7 +410,7 @@ class Set { void print_stats(StringRef name = "") const { HashTableStats stats(*this, *this); - stats.print(); + stats.print(name); } /** diff --git a/source/blender/blenlib/BLI_vector_set.hh b/source/blender/blenlib/BLI_vector_set.hh index d330d3c3247..dcd4927aed2 100644 --- a/source/blender/blenlib/BLI_vector_set.hh +++ b/source/blender/blenlib/BLI_vector_set.hh @@ -433,7 +433,7 @@ class VectorSet { void print_stats(StringRef name = "") const { HashTableStats stats(*this, this->as_span()); - stats.print(); + stats.print(name); } /** @@ -482,7 +482,7 @@ class VectorSet { */ uint32_t size_in_bytes() const { - return sizeof(Slot) * m_slots.size() + sizeof(Key) * m_usable_slots; + return (uint32_t)(sizeof(Slot) * m_slots.size() + sizeof(Key) * m_usable_slots); } /** |