From 2438d45f239b48b5d4a256fa7b5b7dda4966005c Mon Sep 17 00:00:00 2001 From: Owen Arnold <owen.arnold@stfc.ac.uk> Date: Mon, 21 Jan 2019 13:09:11 +0000 Subject: [PATCH] refs #24322. Ref = Value Type on iterator_facade --- .../inc/MantidGeometry/Instrument/InfoIteratorBase.h | 10 +++++----- .../api/ComponentInfoPythonIterator.h | 2 +- .../api/DetectorInfoPythonIterator.h | 2 +- .../src/Exports/ComponentInfoPythonIterator.cpp | 6 ++---- .../src/Exports/DetectorInfoPythonIterator.cpp | 4 +--- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/Framework/Geometry/inc/MantidGeometry/Instrument/InfoIteratorBase.h b/Framework/Geometry/inc/MantidGeometry/Instrument/InfoIteratorBase.h index eccc9ef0de9..c31f398f380 100644 --- a/Framework/Geometry/inc/MantidGeometry/Instrument/InfoIteratorBase.h +++ b/Framework/Geometry/inc/MantidGeometry/Instrument/InfoIteratorBase.h @@ -20,9 +20,9 @@ via a random access iterator. */ template <typename T, template <typename> class InfoItem> class InfoIteratorBase - : public boost::iterator_facade<InfoIteratorBase<T, InfoItem>, - InfoItem<T> &, - boost::random_access_traversal_tag> { + : public boost::iterator_facade<InfoIteratorBase<T, InfoItem>, InfoItem<T>, + boost::random_access_traversal_tag, + InfoItem<T>> { public: InfoIteratorBase(T &info, const size_t index) : m_item(info, index) {} @@ -59,14 +59,14 @@ private: return getIndex() == other.getIndex(); } - InfoItem<T> &dereference() const { return m_item; } + InfoItem<T> dereference() const { return m_item; } uint64_t distance_to(const InfoIteratorBase<T, InfoItem> &other) const { return static_cast<uint64_t>(other.getIndex()) - static_cast<uint64_t>(getIndex()); } - mutable InfoItem<T> m_item; + InfoItem<T> m_item; }; } // namespace Geometry } // namespace Mantid diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/api/ComponentInfoPythonIterator.h b/Framework/PythonInterface/inc/MantidPythonInterface/api/ComponentInfoPythonIterator.h index 1d364091277..e1cc280bf4e 100644 --- a/Framework/PythonInterface/inc/MantidPythonInterface/api/ComponentInfoPythonIterator.h +++ b/Framework/PythonInterface/inc/MantidPythonInterface/api/ComponentInfoPythonIterator.h @@ -33,7 +33,7 @@ public: : m_begin(detectorInfo.begin()), m_end(detectorInfo.end()), m_firstOrDone(true) {} - const ComponentInfoItem<ComponentInfo> &next() { + ComponentInfoItem<ComponentInfo> next() { if (!m_firstOrDone) ++m_begin; else diff --git a/Framework/PythonInterface/inc/MantidPythonInterface/api/DetectorInfoPythonIterator.h b/Framework/PythonInterface/inc/MantidPythonInterface/api/DetectorInfoPythonIterator.h index ee194aaaa3e..42c10470115 100644 --- a/Framework/PythonInterface/inc/MantidPythonInterface/api/DetectorInfoPythonIterator.h +++ b/Framework/PythonInterface/inc/MantidPythonInterface/api/DetectorInfoPythonIterator.h @@ -42,7 +42,7 @@ public: : m_begin(detectorInfo.begin()), m_end(detectorInfo.end()), m_firstOrDone(true) {} - const DetectorInfoItem<DetectorInfo> &next() { + DetectorInfoItem<DetectorInfo> next() { if (!m_firstOrDone) ++m_begin; else diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp index 8481f68b5bd..3a967c61759 100644 --- a/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp +++ b/Framework/PythonInterface/mantid/geometry/src/Exports/ComponentInfoPythonIterator.cpp @@ -5,9 +5,8 @@ // & Institut Laue - Langevin // SPDX - License - Identifier: GPL - 3.0 + #include "MantidPythonInterface/api/ComponentInfoPythonIterator.h" - +#include "MantidPythonInterface/core/VersionCompat.h" #include <boost/python/class.hpp> -#include <boost/python/copy_const_reference.hpp> #include <boost/python/iterator.hpp> #include <boost/python/module.hpp> @@ -23,8 +22,7 @@ void export_ComponentInfoPythonIterator() { #ifdef IS_PY3K .def("__next__", &ComponentInfoPythonIterator::next) #else - .def("next", &ComponentInfoPythonIterator::next, - return_value_policy<copy_const_reference>()) + .def("next", &ComponentInfoPythonIterator::next) #endif ; /* diff --git a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp index 68816097784..060495bf825 100644 --- a/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp +++ b/Framework/PythonInterface/mantid/geometry/src/Exports/DetectorInfoPythonIterator.cpp @@ -7,7 +7,6 @@ #include "MantidPythonInterface/api/DetectorInfoPythonIterator.h" #include "MantidPythonInterface/core/VersionCompat.h" #include <boost/python/class.hpp> -#include <boost/python/copy_const_reference.hpp> #include <boost/python/iterator.hpp> #include <boost/python/module.hpp> @@ -23,8 +22,7 @@ void export_DetectorInfoPythonIterator() { #ifdef IS_PY3K .def("__next__", &DetectorInfoPythonIterator::next) #else - .def("next", &DetectorInfoPythonIterator::next, - return_value_policy<copy_const_reference>()) + .def("next", &DetectorInfoPythonIterator::next) #endif ; /* -- GitLab