aboutsummaryrefslogtreecommitdiff
path: root/include/armnn/utility/TransformIterator.hpp
diff options
context:
space:
mode:
authorRob Hughes <robert.hughes@arm.com>2021-09-21 14:43:16 +0100
committerRob Hughes <robert.hughes@arm.com>2021-09-21 14:43:16 +0100
commitc316c980bff21b489b31ad8bbe074fcdf4ccddbd (patch)
tree94f2a5c8e750525c8c304b775ba4ca5a619707bf /include/armnn/utility/TransformIterator.hpp
parenta3268f13d2b7abb9ae075389b4faae2b660d4889 (diff)
downloadarmnn-c316c980bff21b489b31ad8bbe074fcdf4ccddbd.tar.gz
Fix compile error in TransformIterator
The operator= functions were raising a compiler error on MSVC. The implementations of these functions also looked very suspicious as they were not behaving as a normal operator= would - they did not modify the 'this' object at all, and returned a copy rather than a reference. This patch changes them to be more conventional, which required removing the 'const' qualifier from m_fn in order to make the object assignable. Change-Id: I1c8b526581ed8973e64f1cffc43b97ac88e07699 Signed-off-by: Rob Hughes <robert.hughes@arm.com>
Diffstat (limited to 'include/armnn/utility/TransformIterator.hpp')
-rw-r--r--include/armnn/utility/TransformIterator.hpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/include/armnn/utility/TransformIterator.hpp b/include/armnn/utility/TransformIterator.hpp
index 66fee8715d..f65ac790d0 100644
--- a/include/armnn/utility/TransformIterator.hpp
+++ b/include/armnn/utility/TransformIterator.hpp
@@ -32,14 +32,18 @@ public:
~TransformIterator() = default;
- TransformIterator operator=(TransformIterator const& transformIterator)
+ TransformIterator& operator=(TransformIterator const& rhs)
{
- return { transformIterator.m_it, transformIterator.m_fn };
+ m_fn = rhs.m_fn;
+ m_it = rhs.m_it;
+ return *this;
}
- TransformIterator operator=(TransformIterator&& transformIterator)
+ TransformIterator& operator=(TransformIterator&& rhs)
{
- return { transformIterator.m_it, transformIterator.m_fn };
+ m_fn = std::move(rhs.m_fn);
+ m_it = std::move(rhs.m_it);
+ return *this;
}
TransformIterator operator++() {++m_it; return *this;}
@@ -70,7 +74,7 @@ public:
private:
Iterator m_it;
- const Function m_fn;
+ Function m_fn;
};
template<typename Function, typename Iterator>