diff options
Diffstat (limited to 'source/blender/blenlib/BLI_map.hh')
-rw-r--r-- | source/blender/blenlib/BLI_map.hh | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/source/blender/blenlib/BLI_map.hh b/source/blender/blenlib/BLI_map.hh index 9737367ebca..48cbcb4e3e9 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()}; |