From c316c980bff21b489b31ad8bbe074fcdf4ccddbd Mon Sep 17 00:00:00 2001 From: Rob Hughes Date: Tue, 21 Sep 2021 14:43:16 +0100 Subject: 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 --- include/armnn/utility/TransformIterator.hpp | 14 +++++++++----- 1 file 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 -- cgit v1.2.1