diff --git a/Framework/API/inc/MantidAPI/WorkspaceProperty.h b/Framework/API/inc/MantidAPI/WorkspaceProperty.h index 75a5d27dfe5373a77687b6f78eeaccd8b61f5cd9..fc9a66d00dff7b8fa0309a6e24532993fafc086f 100644 --- a/Framework/API/inc/MantidAPI/WorkspaceProperty.h +++ b/Framework/API/inc/MantidAPI/WorkspaceProperty.h @@ -95,8 +95,7 @@ public: WorkspaceProperty &operator=(const WorkspaceProperty &right); - boost::shared_ptr<TYPE> & - operator=(const boost::shared_ptr<TYPE> &value) override; + WorkspaceProperty &operator=(const boost::shared_ptr<TYPE> &value) override; WorkspaceProperty &operator+=(Kernel::Property const *) override; diff --git a/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc b/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc index 1dbcb92a0223ffe7d98ac37911be1082c1cc5218..1894b6dded19fe397cfe069421575a33afcee2fd 100644 --- a/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc +++ b/Framework/API/inc/MantidAPI/WorkspaceProperty.tcc @@ -107,13 +107,14 @@ operator=(const WorkspaceProperty &right) { * @return assigned PropertyWithValue */ template <typename TYPE> -boost::shared_ptr<TYPE> &WorkspaceProperty<TYPE>:: +WorkspaceProperty<TYPE> &WorkspaceProperty<TYPE>:: operator=(const boost::shared_ptr<TYPE> &value) { std::string wsName = value->getName(); if (this->direction() == Kernel::Direction::Input && !wsName.empty()) { m_workspaceName = wsName; } - return Kernel::PropertyWithValue<boost::shared_ptr<TYPE>>::operator=(value); + Kernel::PropertyWithValue<boost::shared_ptr<TYPE>>::operator=(value); + return *this; } //-------------------------------------------------------------------------------------- diff --git a/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc b/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc index a4902017dbb7104790d56d09cb1a6fcb93393f37..af580021274c2f9dc67441d495ea6158b94fe138 100644 --- a/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc +++ b/Framework/Kernel/inc/MantidKernel/PropertyWithValue.tcc @@ -259,7 +259,7 @@ operator+=(Property const *right) { * @return the reference to itself */ template <typename TYPE> -TYPE &PropertyWithValue<TYPE>::operator=(const TYPE &value) { +PropertyWithValue<TYPE> &PropertyWithValue<TYPE>::operator=(const TYPE &value) { TYPE oldValue = m_value; if (std::is_same<TYPE, std::string>::value) { std::string valueCopy = toString(value); @@ -272,10 +272,10 @@ TYPE &PropertyWithValue<TYPE>::operator=(const TYPE &value) { } std::string problem = this->isValid(); if (problem.empty()) { - return m_value; + return *this; } else if (problem == "_alias") { m_value = getValueForAlias(value); - return m_value; + return *this; } else { m_value = oldValue; throw std::invalid_argument(problem); diff --git a/Framework/Kernel/test/ArrayPropertyTest.h b/Framework/Kernel/test/ArrayPropertyTest.h index 75408b0d46d6535385a074c232c3dc93cefbb565..f15f1f2ab2e40e36fcb639a7a502672ea30a2313 100644 --- a/Framework/Kernel/test/ArrayPropertyTest.h +++ b/Framework/Kernel/test/ArrayPropertyTest.h @@ -242,21 +242,24 @@ public: ArrayProperty<int> i("i"); TS_ASSERT(i.isDefault()) std::vector<int> ii(3, 4); - TS_ASSERT_EQUALS(i = ii, ii) + i = ii; + TS_ASSERT_EQUALS(i.operator()(), ii); TS_ASSERT_EQUALS(i.operator()()[1], 4) TS_ASSERT(!i.isDefault()) ArrayProperty<double> d("d"); TS_ASSERT(d.isDefault()) std::vector<double> dd(5, 9.99); - TS_ASSERT_EQUALS(d = dd, dd) + d = dd; + TS_ASSERT_EQUALS(d.operator()(), dd); TS_ASSERT_EQUALS(d.operator()()[3], 9.99) TS_ASSERT(!d.isDefault()) ArrayProperty<std::string> s("s"); TS_ASSERT(s.isDefault()) std::vector<std::string> ss(2, "zzz"); - TS_ASSERT_EQUALS(s = ss, ss) + s = ss; + TS_ASSERT_EQUALS(s.operator()(), ss) TS_ASSERT_EQUALS(s.operator()()[0], "zzz") TS_ASSERT(!s.isDefault()) }