From 8dec405f4fecc1dd9257ab116be5e8bb84a567bd Mon Sep 17 00:00:00 2001 From: Wojciech Figat Date: Fri, 21 Oct 2022 15:40:47 +0200 Subject: [PATCH] Add iterator copy operator in collections --- Source/Engine/Core/Collections/Array.h | 7 +++++++ Source/Engine/Core/Collections/Dictionary.h | 7 +++++++ Source/Engine/Core/Collections/HashSet.h | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/Source/Engine/Core/Collections/Array.h b/Source/Engine/Core/Collections/Array.h index d5d93495f..b89acc44f 100644 --- a/Source/Engine/Core/Collections/Array.h +++ b/Source/Engine/Core/Collections/Array.h @@ -965,6 +965,13 @@ public: return _array != v._array || _index != v._index; } + Iterator& operator=(const Iterator& v) + { + _array = v._array; + _index = v._index; + return *this; + } + Iterator& operator++() { if (_index != _array->Count()) diff --git a/Source/Engine/Core/Collections/Dictionary.h b/Source/Engine/Core/Collections/Dictionary.h index 0ee455195..feda96bd7 100644 --- a/Source/Engine/Core/Collections/Dictionary.h +++ b/Source/Engine/Core/Collections/Dictionary.h @@ -311,6 +311,13 @@ public: return _index != v._index || &_collection != &v._collection; } + Iterator& operator=(const Iterator& v) + { + _collection = v._collection; + _index = v._index; + return *this; + } + Iterator& operator++() { const int32 capacity = _collection.Capacity(); diff --git a/Source/Engine/Core/Collections/HashSet.h b/Source/Engine/Core/Collections/HashSet.h index debd91cfd..304d07926 100644 --- a/Source/Engine/Core/Collections/HashSet.h +++ b/Source/Engine/Core/Collections/HashSet.h @@ -282,6 +282,13 @@ public: return _index != v._index || &_collection != &v._collection; } + Iterator& operator=(const Iterator& v) + { + _collection = v._collection; + _index = v._index; + return *this; + } + Iterator& operator++() { const int32 capacity = _collection.Capacity();